1

ffmpeg версия git-2014-01-14-abcde

ffprobe -show_frames a.mp4 | grep pict_type=I | wc идентифицирует 142 I-кадра.

ffmpeg -i a.mp4 -filter:v select='eq(pict_type\,I)' I.%03d.png генерирует тысячи png.

Как я могу извлечь только 142?

РЕДАКТИРОВАНИЕ № 1:

$ ffmpeg -i a.mp4 -filter:v select='eq(pict_type\,I)' I.%03d.png
ffmpeg version git-2014-01-14-abcde copyright (c) 2000-2014 the FFmpeg developers
  built on Jan 14 2014 09:10:34 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
  configuration: <snip>
  libavutil      52. 62.100 / 52. 62.100
  libavcodec     55. 48.101 / 55. 48.101
  libavformat    55. 23.103 / 55. 23.103
  libavdevice    55.  5.102 / 55.  5.102
  libavfilter     4.  1.100 /  4.  1.100
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
  libpostproc    52.  3.100 / 52.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'a.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    creation_time   : 1970-01-01 00:00:00
    encoder         : Lavf53.29.100
  Duration: 00:19:02.63, start: 0.000000, bitrate: 128 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 960x540 [SAR 1:1 DAR 16:9], 43 kb/s, 30 fps, 30 tbr, 30 tbn, 60 tbc (default)
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 75 kb/s (default)
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    : SoundHandler
Output #0, image2, to 'I.%03d.png':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf55.23.103
    Stream #0:0(und): Video: png, rgb24, 960x540 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 90k tbn, 30 tbc (default)
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    : VideoHandler
Stream mapping:
  Stream #0:0 -> #0:0 (h264 -> png)
Press [q] to stop, [?] for help

РЕДАКТИРОВАТЬ № 2:

Press [q] to stop, [?] for help
frame=34228 fps=9.6 q=0.0 Lsize=N/A time=00:19:00.93 bitrate=N/A dup=34086 drop=0    
video:5583968kB audio:0kB subtitle:0 global headers:0kB muxing overhead -100.000000%

1 ответ1

3

http://www.ffmpeg.org/ffmpeg-filters.html#Examples-10

-vsync 0

ffmpeg -i a.mp4 -filter:v select='eq(pict_type\,I)' -vsync 0 I.%06d.png

$ ffmpeg -i a.mp4 -filter:v select='eq(pict_type\,I)' -vsync 0 I.%06d.png
ffmpeg version git-2014-01-14-abcde Copyright (c) 2000-2014 the FFmpeg developers
  built on Jan 14 2014 09:10:34 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
  configuration: <snip>
  libavutil      52. 62.100 / 52. 62.100
  libavcodec     55. 48.101 / 55. 48.101
  libavformat    55. 23.103 / 55. 23.103
  libavdevice    55.  5.102 / 55.  5.102
  libavfilter     4.  1.100 /  4.  1.100
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
  libpostproc    52.  3.100 / 52.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'a.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    creation_time   : 1970-01-01 00:00:00
    encoder         : Lavf53.29.100
  Duration: 00:19:02.63, start: 0.000000, bitrate: 128 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 960x540 [SAR 1:1 DAR 16:9], 43 kb/s, 30 fps, 30 tbr, 30 tbn, 60 tbc (default)
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 75 kb/s (default)
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    : SoundHandler
Output #0, image2, to 'I.%06d.png':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf55.23.103
    Stream #0:0(und): Video: png, rgb24, 960x540 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 90k tbn, 30 tbc (default)
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    : VideoHandler
Stream mapping:
  Stream #0:0 -> #0:0 (h264 -> png)
Press [q] to stop, [?] for help
frame=  142 fps=1.0 q=0.0 Lsize=N/A time=00:19:00.93 bitrate=N/A    
video:22992kB audio:0kB subtitle:0 global headers:0kB muxing overhead -100.000093%

Всё ещё ищете ответ? Посмотрите другие вопросы с метками .