New submission from Laurent <[email protected]>:

Hi,

I am using ffmpeg to extract frames at various positions in a video file.
The command is eg:
  ffmpeg -ss 1 -i mympeg2.mpg -vframes 1 screenshot.jpg

Depending on the ss, I'll get most of the time a monochrome grey frame, and
sometime a good frame.

This command is working well on h264 and wmv3 files.
This seems to be specific to mpeg2 files (tested with several of them).

Also, using ss option after the input file, eg:
  ffmpeg -i mympeg2.mpg -ss 1 [...]
does work, but is O(n) instead of O(1) in time (which makes a huge difference
when extracting frames in the middle of a movie).

This has been working with old ffmpeg (tested with r9133!).

Here is ffmpeg output:
$ ffmpeg -v 9 -loglevel 99 -ss 41.550 -i mympeg2.mpg -vframes 1 screenshot.jpg
FFmpeg version SVN-r23635, Copyright (c) 2000-2010 the FFmpeg developers
  built on Jun 17 2010 04:09:54 with gcc 4.4.2
  configuration: --target-os=mingw32 --enable-runtime-cpudetect
--enable-avisynth --enable-gpl --enable-version3 --enable-bzlib --enable-libgsm
--enable-libfaad --enable-pthreads --enable-libvorbis --enable-libtheora
--enable-libspeex --enable-libmp3lame --enable-libopenjpeg --enable-libxvid
--enable-libschroedinger --enable-libx264 --extra-libs='-lx264 -lpthread'
--enable-libopencore_amrwb --enable-libopencore_amrnb --enable-librtmp
--extra-libs='-lrtmp -lpolarssl -lws2_32 -lwinmm' --arch=x86
--cross-prefix=i686-mingw32- --cc='ccache i686-mingw32-gcc' 
--enable-memalign-hack
  libavutil     50.19. 0 / 50.19. 0
  libavcodec    52.76. 0 / 52.76. 0
  libavformat   52.68. 0 / 52.68. 0
  libavdevice   52. 2. 0 / 52. 2. 0
  libavfilter    1.20. 0 /  1.20. 0
  libswscale     0.11. 0 /  0.11. 0
[NULL @ 003fdee0]Probed with size=8192 and score=52
[mpeg @ 003fdee0]probing stream 0
    Last message repeated 32 times
[mpeg @ 003fdee0]Probe with size=66706, packets=33 detected mpegvideo with 
score=51
[mpeg @ 003fdee0]probed stream 0
[mpeg @ 003fdee0]Probe buffer size limit 5000000 reached
[mpeg @ 003fdee0]read_seek: 0 3766587
[mpeg @ 003fdee0]using cached pos_min=0x4cf00e dts_min=471531
[mpeg @ 003fdee0]using cached pos_max=0x398400e pos_limit=0x398400e 
dts_max=5381436
[mpeg @ 003fdee0]gen_seek: 0 3766587
[mpeg @ 003fdee0]pos_min=0x4cf00e pos_max=0x398400e dts_min=471531 
dts_max=5381436
[mpeg @ 003fdee0]5042190 42139662 60309518 / 471531 3765822 5381436
target:3766587 limit:60309518 start:42132305 noc:0
[mpeg @ 003fdee0]pos_min=0x283000e pos_max=0x398400e dts_min=3765822 
dts_max=5381436
[mpeg @ 003fdee0]42139662 42162190 60309518 / 3765822 3768825 5381436
target:3766587 limit:60309518 start:42148266 noc:0
[mpeg @ 003fdee0]pos_min=0x283000e pos_max=0x283580e dts_min=3765822 
dts_max=3768825
[mpeg @ 003fdee0]42139662 42162190 42162190 / 3765822 3768825 3768825
target:3766587 limit:42148265 start:42139663 noc:1
[mpeg @ 003fdee0]pos=0x283000e 3765822<=3766587<=3768825
Input #0, mpeg, from 'c:\Program Files\Stratacache\Contents\FC_57_27A_A.mpg':
  Duration: 00:00:59.72, start: 0.300967, bitrate: 8109 kb/s
    Stream #0.0[0x1e0], 150, 1/90000: Video: mpeg2video, yuv420p, 720x480 [PAR
32:27 DAR 16:9], 1001/60000, 8000 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
[ffmpeg_output @ 01d42750]auto-inserting filter 'auto-inserted scaler 0' between
the filter 'src' and the filter 'out'
[scale @ 01e0fef0]w:720 h:480 fmt:yuv420p -> w:720 h:480 fmt:yuvj420p flags:0x4
Output #0, image2, to 'screenshot.jpg':
  Metadata:
    encoder         : Lavf52.68.0
    Stream #0.0, 0, 1/90000: Video: mjpeg, yuvj420p, 720x480 [PAR 32:27 DAR
16:9], 1001/30000, q=2-31, 200 kb/s, 90k tbn, 29.97 tbc
Stream mapping:
  Stream #0.0 -> #0.0
Press [q] to stop encoding
[mpeg @ 003fdee0]invalid dts/pts combination
[mpeg2video @ 003ff270]warning: first frame is no keyframe
frame=    1 fps=  0 q=1.6 Lsize=      -0kB time=0.03 bitrate=  -5.3kbits/s    

video:6kB audio:0kB global headers:0kB muxing overhead -100.370183%

Note: this issue might be related to issue 1963.

----------
messages: 10864
priority: normal
status: new
substatus: new
title: Frame extraction returns a grey image with mpeg2 video
type: bug

________________________________________________
FFmpeg issue tracker <[email protected]>
<https://roundup.ffmpeg.org/issue2019>
________________________________________________

Reply via email to