Opened 9 years ago

Last modified 6 years ago

#4362 new defect

ffmpeg can't extract screenshot from webm if -loop 1 not included, fails silently

Reported by: Fredrick Brennan Owned by:
Priority: normal Component: ffmpeg
Version: git-master Keywords: seek
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

I own a site (8ch.net) where users are allowed to upload arbitrary WEBM (VP9/Opus or VP8/vorbis) and MP4 (H264/AAC only) files so long as they are under 8MB. Therefore, many users have come up with tricks and codec parameters to tune their files to try to get them to be under the limit.

one-frame-webm-bug.webm ( uploaded to FTP, also available at https://media.8ch.net/test/src/1425957831333.webm ) was generated with the command:

ffmpeg -i shot0002.jpg -i happening.aac one-frame-webm-bug.webm

Browsers (Chrome and Firefox) understand this just fine. They display the image and then play the audio while leaving the image up for the entirety of the video. -loop 1 is not necessary and just a waste of filesize.

However, my thumbnailing routine does this command (log attached):

ffmpeg -y -strict -2 -ss 10 -i one-frame-webm-bug.webm -an -vframes 1 -f mjpeg -vf scale=255:-1 test.jpg

ffmpeg fails because it's asking for frame 10 when only frame 0 was specified.

Output file is empty, nothing was encoded (check -ss / -t / -frames parameters if used)

What's even more annoying is it exits with 0 so I can't even detect there was an error and then run the command again with -ss 0.

Please do not tell me "just use -loop 1", this is a user generated content site and as I said -loop 1 is a waste of filesize with no benefit because all players (even ffplay) understand it correctly, only ffmpeg doesn't.

Please either change the exit status to something non-zero because this is obviously a failure or fix the underlying bug where it doesn't understand the video file correctly.

Tested on versions 1.2.6, 2.5.4 and 2.6. Happens on all of them.

Attachments (1)

ffmpeg-20150310-121650.log (6.6 KB ) - added by Fredrick Brennan 9 years ago.

Download all attachments as: .zip

Change History (3)

by Fredrick Brennan, 9 years ago

Attachment: ffmpeg-20150310-121650.log added

comment:2 by x-yuri, 6 years ago

Keywords: seek added

I think I've run into the same issue:

$ ffmpeg -i _/5.mp4 |& grep Duration
  Duration: 00:00:01.00, start: 0.000000, bitrate: 183 kb/s

$ ffprobe -show_frames _/5.mp4 |& tail -n 30 | egrep 'time|duration|FRAME|type'
[FRAME]
media_type=video
pkt_pts_time=0.967633
pkt_dts_time=N/A
best_effort_timestamp=29029
best_effort_timestamp_time=0.967633
pkt_duration=1001
pkt_duration_time=0.033367
pict_type=P
[/FRAME]

$ echo 0.967633 + 0.033367 | bc -l
1.001000

$ ffmpeg -s 300x300 -c png  -vframes 1 -ss 00:00:00.967650 _/5.mp4.png -i _/5.mp4
ffmpeg version 3.4.2 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 7.3.0 (GCC)
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-avisynth --enable-avresample --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libass --enable-libbluray --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-shared --enable-version3 --enable-omx
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libavresample   3.  7.  0 /  3.  7.  0
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '_/5.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf56.30.100
  Duration: 00:00:01.00, start: 0.000000, bitrate: 183 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 174 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
    Metadata:
      handler_name    : VideoHandler
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> png (native))
Press [q] to stop, [?] for help
Output #0, image2, to '_/5.mp4.png':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.83.100
    Stream #0:0(eng): Video: png, rgb24, 300x300 [SAR 16:9 DAR 16:9], q=2-31, 200 kb/s, 29.97 fps, 29.97 tbn, 29.97 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      encoder         : Lavc57.107.100 png
frame=    0 fps=0.0 q=0.0 Lsize=N/A time=00:00:00.00 bitrate=N/A speed=   0x    
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Output file is empty, nothing was encoded (check -ss / -t / -frames parameters if used)

With -ss 00:00:00.967649 it makes a screenshot. The video is here

Feel free to ask for more details.

Note: See TracTickets for help on using tickets.