使用 ffmpeg 提取关键帧失败

使用 ffmpeg 提取关键帧失败

我正在尝试使用命令从视频文件中提取关键帧:

ffmpeg -i newtape.mp4 -an -r 1 -y -vf "select='eq(pict_type,PICT_TYPE_I)'" -vsync 0 -ss 00:01:00 thumbnail_%09d.jpg

它启动了但很快就失败了:

ffmpeg version 0.7.13, Copyright (c) 2000-2011 the FFmpeg developers   built on Sep 12 2012 14:54:45 with gcc 4.2.2 20070831 prerelease [FreeBSD]   configuration: --prefix=/usr/local --mandir=/usr/local/man
--enable-shared --enable-gpl --enable-postproc --enable-avfilter --enable-pthreads --enable-memalign-hack --enable-runtime-cpudetect --cc=cc --extra-cflags='-I/usr/local/include/vorbis -I/usr/local/include' --ext ra-ldflags='-L/usr/local/lib ' --extra-libs=-pthread --disable-debug --enable-libaacplus --disable-indev=alsa --disable-outdev=alsa --disable-libopencore-amrnb --disable-libopencore-amrwb --disable-libcelt --disable-libdirac --disable-libfaac --disable-ffserver --enable-li bfreetype --enable-frei0r --disable-libgsm --enable-libmp3lame --enable-libopencv --disable-libopenjpeg --disable-librtmp --enable-libschroedinger --disable-ffplay --disable-libspeex --enable-libtheora --disable-vaapi --disable-vdpau --disable-libvo-aacenc --disable-libvo- amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-nonfree   libavutil    50. 43. 0 / 50. 43. 0   libavcodec   52.123. 0 / 52.123. 0   libavformat  52.111. 0 / 52.111. 0   libavdevice  52.  5. 0 / 52. 
5. 0   libavfilter   1. 80. 0 /  1. 80. 0   libswscale    0. 14. 1 /  0. 14. 1   libpostproc  51.  2. 0 / 51.  2. 0 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'newtape.mp4':   Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: mp41
    creation_time   : 2012-10-14 12:44:32
    encoder         : Lavf51.12.1   Duration: 00:34:12.05, start: 0.000000, bitrate: 2653 kb/s
Stream #0.0(und): Video: h264 (Constrained Baseline), yuv420p, 960x540 [PAR 1:1 DAR 16:9], 2537 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc
    Metadata:
      creation_time   : 2012-10-14 14:00:24
Stream #0.1(und): Audio: aac, 48000 Hz, stereo, s16, 110 kb/s
    Metadata:
      creation_time   : 2012-10-14 14:00:24 
    Incompatible pixel format 'yuv420p' for codec 'mjpeg', auto-selecting format 'yuvj420p' 
    [buffer @ 0x805a24260] w:960 h:540 pixfmt:yuv420p tb:1/1000000 sar:1/1 sws_param: 
    [select @ 0x805a24340] auto-inserting filter 'auto-inserted scaler 0' between the filter 'src' and the filter 'Parsed filter 0 select' 
    [scale @ 0x805a243a0] w:960 h:540 fmt:yuv420p -> w:960 h:540 fmt:yuvj420p flags:0x4  
Output #0, image2, to 'thumbnail_%09d.jpg':   
    Metadata:
      major_brand     : isom
      minor_version   : 512
      compatible_brands: mp41
      creation_time   : 2012-10-14 12:44:32
      encoder         : Lavf52.111.0
Stream #0.0(und): Video: mjpeg, yuvj420p, 960x540 [PAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 90k tbn, 1 tbc
    Metadata:
      creation_time   : 2012-10-14 14:00:24 
Stream mapping:   
    Stream #0.0 -> #0.0 

Press [q] to stop, [?] for help 
[mjpeg @ 0x805a11420] Error, Invalid timestamp=0, last=000 bitrate=   0.0kbits/s   
Video encoding failed

有什么方法可以防止这种情况发生,也许自动跳过一些片段?

相关内容