Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I use ffmpeg to generate 10 .jpeg thumbs out of a video file. Most of the time it works fine but for some files (a 55seconds .mp4 for example) I get only the first 4 out of 10 captures, for the rest I get this error:
Output file is empty, nothing was encoded (check -ss / -t / -frames parameters if used)

The command I use to convert is this one
ffmpeg -ss 16 -i /path/source.mp4 -y -f image2 -t 0.001 -s 320*240 /path/thumb4.jpg
where -ss value is a multiple of 4 and from 20 it stops working.

Command line full output:

`# ffmpeg -ss 77 -i /path/source.mp4 -y -f image2 -t 0.001 -s 320*240 /path/thumb7.jpg  
ffmpeg version git-2013-02-25-b8f6912 Copyright (c) 2000-2013 the FFmpeg developers  
  built on Feb 25 2013 15:18:21 with gcc 4.4.5 (Debian 4.4.5-8)  
  configuration: --enable-shared --enable-libx264 --enable-gpl  
  libavutil      52. 17.103 / 52. 17.103  
  libavcodec     54. 92.100 / 54. 92.100  
  libavformat    54. 63.100 / 54. 63.100  
  libavdevice    54.  3.103 / 54.  3.103  
  libavfilter     3. 41.100 /  3. 41.100  
  libswscale      2.  2.100 /  2.  2.100  
  libswresample   0. 17.102 /  0. 17.102  
  libpostproc    52.  2.100 / 52.  2.100  
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/path/source.mp4':  
  Metadata:  
    major_brand     : mp42  
    minor_version   : 19529845  
    compatible_brands: mp42isom  
    creation_time   : 2013-03-20 21:45:43  
  Duration: 00:02:04.62, start: 0.000000, bitrate: 605 kb/s  
    Stream #0:0(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 64 kb/s  
    Metadata:  
      creation_time   : 2013-03-20 21:45:43  
      handler_name    : Sound Media Handler  
    Stream #0:1(eng): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p, 720x480 [SAR 40:33 DAR 20:11], 983 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc  
    Metadata:  
      creation_time   : 2013-03-20 21:45:43  
      handler_name    : Video Media Handler  
Output #0, image2, to '/path/thumb7.jpg':  
  Metadata:  
    major_brand     : mp42  
    minor_version   : 19529845  
    compatible_brands: mp42isom  
    encoder         : Lavf54.63.100  
    Stream #0:0(eng): Video: mjpeg, yuvj420p, 320x240 [SAR 15:11 DAR 20:11], q=2-31, 200 kb/s, 90k tbn, 29.97 tbc  
    Metadata:
      creation_time   : 2013-03-20 21:45:43  
      handler_name    : Video Media Handler  
Stream mapping:  
  Stream #0:1 -> #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 global headers:0kB muxing overhead -inf%  
Output file is empty, nothing was encoded (check -ss / -t / -frames parameters if used)`  
share|improve this question

migrated from stackoverflow.com Mar 25 '13 at 12:16

This question came from our site for professional and enthusiast programmers.

1 Answer 1

up vote 1 down vote accepted

When you specify -t 0.001 you might end up exporting nothing. This is not the correct way of saying that you only need one frame. The -t option takes either seconds or a timestamp in the HH:MM:SS.mmm format.

Here's what should work:

ffmpeg -ss 16 -i /path/source.mp4 -frames:v 1 -s 320x240 /path/thumb4.jpg

Note that the -f image2 option is not needed as the correct output format will be chosen anyway.

share|improve this answer
    
I understand. Unfortunately I work on an adult-oriented project thus the only strange working examples are adult. Anyway, per your suggestion I tried converting the MP4 file to another MP4 file and I got an error: Truncating packet of size 3544 to 682 [h264 @ 0x6784e0] AVC: nal size 3534 [h264 @ 0x6784e0] no frame! Error while decoding stream #0:1: Operation not permitted [mov,mp4,m4a,3gp,3g2,mj2 @ 0x676040] stream 1, offset 0x8ffccb: partial file 3IgLCrIR37np070SlwOu.mp4: Invalid data found when processing input –  Alex Flo Mar 25 '13 at 13:49
    
That means my test file is broken? –  Alex Flo Mar 25 '13 at 13:49
    
Yes, indeed. That's a decoding error due to a malformatted stream – no idea if that's easy to repair though. –  slhck Mar 25 '13 at 13:53
    
I see. Thank you. I run ffmpeg from a BASH script, are you aware of a (simple) way of letting BASH script know that ffmpeg failed with an error so I can cover this option as well? –  Alex Flo Mar 25 '13 at 13:55
    
If you run ffmpeg -y -loglevel quiet -i input.mp4 … && echo "yay" || echo "nay" this should catch errors, e.g. print nay on a failed command. –  slhck Mar 25 '13 at 14:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.