6
I have been using the following ffmpeg command successfully to extract the first frame of an mp4 file:
./ffmpeg -i video.mp4 -vframes 1 -y frame.bmp
However, when I try to use the below pipe syntax, I get an error:
cat video.mp4 | ./ffmpeg -i pipe:0 -vframes 1 -y frame.bmp
This is the output that I am getting:
> ffmpeg version 2.4.1- http://johnvansickle.com/ffmpeg/ Copyright
> (c) 2000-2014 the FFmpeg developers built on Sep 24 2014 18:52:48
> with gcc 4.8 (Debian 4.8.3-11) configuration: --enable-gpl
> --enable-version3 --disable-shared --disable-debug --enable-runtime-cpudetect --enable-libmp3lame --enable-libx264 --enable-libx265 --enable-libwebp --enable-libspeex --enable-libvorbis --enable-libvpx --enable-libfreetype --enable-fontconfig --enable-libxvid --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-gray --enable-libopenjpeg --enable-libopus --disable-ffserver --enable-libass --enable-gnutls --cc=gcc-4.8 libavutil 54. 7.100 / 54. 7.100 libavcodec 56. 1.100 / 56. 1.100 libavformat 56. 4.101 / 56. 4.101 libavdevice 56. 0.100 /
> 56. 0.100 libavfilter 5. 1.100 / 5. 1.100 libswscale 3. 0.100 / 3. 0.100 libswresample 1. 1.100 / 1. 1.100 libpostproc 53. 0.100 / 53. 0.100 [mov,mp4,m4a,3gp,3g2,mj2 @
> 0x37537e0] stream 0, offset 0x2c: partial file
> [mov,mp4,m4a,3gp,3g2,mj2 @ 0x37537e0] Could not find codec parameters
> for stream 1 (Video: h264 (avc1 / 0x31637661), 480x480, 972 kb/s):
> unspecified pixel format Consider increasing the value for the
> 'analyzeduration' and 'probesize' options Input #0,
> mov,mp4,m4a,3gp,3g2,mj2, from 'pipe:0': Metadata:
> major_brand : mp42
> minor_version : 1
> compatible_brands: mp41mp42isom
> creation_time : 2014-09-26 09:05:37 Duration: 00:00:02.77, bitrate: N/A
> Stream #0:0(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 61 kb/s (default)
> Metadata:
> creation_time : 2014-09-26 09:05:37
> handler_name : Core Media Audio
> Stream #0:1(und): Video: h264 (avc1 / 0x31637661), 480x480, 972 kb/s, 24.01 fps, 24 tbr, 600 tbn, 1200 tbc (default)
> Metadata:
> creation_time : 2014-09-26 09:05:37
> handler_name : Core Media Video [buffer @ 0x3742860] Unable to parse option value "-1" as pixel format
> Last message repeated 1 times [buffer @ 0x3742860] Error setting option pix_fmt to value -1. [graph 0 input from stream 0:1 @
> 0x3752d20] Error applying options to the filter. Error opening
> filters!
I am using the latest ffmpeg 64-bit binaries on Ubuntu 14.04.
1Nothing obviously wrong, though I have not used
ffmpeg
much. Two things to try: use-i /dev/stdin
; also see if<video.mp4
works instead of piping fromcat
. I have a few wild surmises, and these may help clarify them. – AFH – 2014-10-08T13:56:14.4401try
-i -
. that is the standard input. – Rajib – 2014-10-14T04:13:49.660So I tried: cat video.mp4 | ./ffmpeg -i /dev/stdin -vframes 1 -y frame.bmp (did not work either), cat video.mp4 | ./ffmpeg -i - -vframes 1 -y frame.bmp (did not work either), ./ffmpeg -i pipe:0 -vframes 1 -y frame.bmp <video.mp4 (did not work either) – quentinadam – 2014-10-14T06:52:45.833
Does it work when you specify
ffmpeg -f mp4 -i - …
to force the format? I can't reproduce it, really. – slhck – 2014-10-18T16:24:10.233Did you ever get this working? I'm hitting the same issue when using a pipe. It does however seem to work fine for videos with moov at the start of the file. I've tried setting analyzeduration and probesize but no luck. – Christos – 2015-09-03T06:08:48.943
Just saw Linked question, looks like moving moov to the start of the file will fix things. – Christos – 2015-09-03T06:10:24.370