2

I have a video file and I'm trying to generate screenshots from it.
When I use this command
ffmpeg -ss 500 -i video_file.mp4 -frames:v 1 -y -s 263*196 output_screenshot.jpg
a screenshot is generated just fine.

When I try with
ffmpeg -ss 900 -i video_file.mp4 -frames:v 1 -y -s 263*196 output_screenshot.jpg
(so 900 instead of 500) I get this error
ffmpeg -ss 900 -i video_file.mp4 -frames:v 1 -y -s 263*196 output_screenshot.jpg ffmpeg version git-2014-03-11-61f96be Copyright (c) 2000-2014 the FFmpeg developers built on Mar 11 2014 14:16:57 with gcc 4.7 (Debian 4.7.2-5) configuration: --enable-gpl --enable-postproc --enable-swscale --enable-pthreads --enable-x11grab --enable-libdc1394 --enable-libfaac --enable-libgsm --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-nonfree --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfdk-aac --enable-libopus --enable-libvpx --enable-libfreetype libavutil 52. 66.101 / 52. 66.101 libavcodec 55. 52.102 / 55. 52.102 libavformat 55. 34.100 / 55. 34.100 libavdevice 55. 11.100 / 55. 11.100 libavfilter 4. 3.100 / 4. 3.100 libswscale 2. 5.101 / 2. 5.101 libswresample 0. 18.100 / 0. 18.100 libpostproc 52. 3.100 / 52. 3.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video_file.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: mp41 creation_time : 2014-04-19 13:56:05 title : My Movie artist :
media_type : 9 season_number : 1 episode_sort : 1 hd_video : 0 Duration: 00:25:45.34, start: 0.000000, bitrate: 1242 kb/s Stream #0:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 720x480 [SAR 1:1 DAR 3:2], 2586 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 58 tbc (default) Metadata: creation_time : 2014-04-19 13:56:05 handler_name : VideoHandler Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 127 kb/s (default) Metadata: creation_time : 2014-04-19 13:56:05 handler_name : SoundHandler [swscaler @ 0x332d880] deprecated pixel format used, make sure you did set range correctly Output #0, image2, to 'output_screenshot.jpg': Metadata: major_brand : isom minor_version : 512 compatible_brands: mp41 hd_video : 0 title : My Movie artist :
media_type : 9 season_number : 1 episode_sort : 1 encoder : Lavf55.34.100 Stream #0:0(eng): Video: mjpeg, yuvj420p, 263x196 [SAR 294:263 DAR 3:2], q=2-31, 200 kb/s, 90k tbn, 29.97 tbc (default) Metadata: creation_time : 2014-04-19 13:56:05 handler_name : VideoHandler Stream mapping: Stream #0:0 -> #0:0 (h264 -> mjpeg) Press [q] to stop, [?] for help frame= 0 fps=0.0 q=0.0 Lsize=N/A time=00:00:00.00 bitrate=N/A
video:0kB audio:0kB subtitle:0 data:0 global headers:0kB muxing overhead 0.000000% Output file is empty, nothing was encoded (check -ss / -t / -frames parameters if used)

and no screenshot is created. I mention that the file is 25min (about 1500 seconds) so 900 should be a perfectly fine value.
Any ideas what could be wrong?

5
  • Does it work when you put the -ss part after the input file?
    – slhck
    Apr 28, 2014 at 11:08
  • @slhck no, it will also fail but it will take much more time till it fails.
    – Alex Flo
    Apr 29, 2014 at 5:54
  • 2
    Have you checked if the input is actually playable up to that point? I sometimes forget to look at the actual material :)
    – slhck
    Apr 29, 2014 at 6:13
  • @slhck Damn!:) You're so right, that was it, the file reported being some 1500seconds long but it was actually truncated thus the impossibility of generating the screenshots
    – Alex Flo
    Apr 29, 2014 at 7:09
  • Oh ok. So problem solved.
    – Rajib
    Apr 29, 2014 at 7:14

1 Answer 1

1

When you don't get an output file, ffmpeg probably cannot seek to that position, or there is no video information at that position.

This means that the file could be broken, or the duration is just incorrectly reported from the container.

Try to play the file and see if it really works until 900 seconds.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .