Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#677 closed enhancement (fixed)

Tell user when -t or -ss value exceeds input duration

Reported by: llogan Owned by:
Priority: wish Component: ffmpeg
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Lately I've seen a few users on ffmpeg-user[1] and #ffmpeg[2] ask why their -t or -ss doesn't work, and in these cases it's because they are using a value that exceeds the input duration.

Current behavior:

$ ffmpeg -ss 12 -i hop.mp4 -t 3 -y out.mpg
ffmpeg version N-35078-g7831788, Copyright (c) 2000-2011 the FFmpeg developers
  built on Nov 22 2011 10:36:32 with gcc 4.6.2
  configuration: --prefix=/usr --enable-gpl
  libavutil    51. 26. 0 / 51. 26. 0
  libavcodec   53. 36. 0 / 53. 36. 0
  libavformat  53. 21. 0 / 53. 21. 0
  libavdevice  53.  4. 0 / 53.  4. 0
  libavfilter   2. 49. 0 /  2. 49. 0
  libswscale    2.  1. 0 /  2.  1. 0
  libpostproc  51.  2. 0 / 51.  2. 0
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'hop.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    creation_time   : 1970-01-01 00:00:00
    encoder         : Lavf52.32.0
  Duration: 00:00:10.13, start: 0.000000, bitrate: 563 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 640x480, 559 kb/s, 30 fps, 30 tbr, 30 tbn, 60 tbc
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    : 
[buffer @ 0x17c1bc0] w:640 h:480 pixfmt:yuv420p tb:1/1000000 sar:0/1 sws_param:
[mpeg @ 0x17cb5e0] VBV buffer size not set, muxing may fail
Output #0, mpeg, to 'out.mpg':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    creation_time   : 1970-01-01 00:00:00
    encoder         : Lavf53.21.0
    Stream #0:0(und): Video: mpeg1video, yuv420p, 640x480, q=2-31, 200 kb/s, 90k tbn, 30 tbc
    Metadata:
      creation_time   : 1970-01-01 00:00:00
      handler_name    : 
Stream mapping:
  Stream #0:0 -> #0:0 (h264 -> mpeg1video)
Press [q] to stop, [?] for help
frame=    0 fps=  0 q=0.0 Lsize=       0kB time=00:00:00.00 bitrate=   0.0kbits/s dup=0 drop=54    
video:0kB audio:0kB global headers:0kB muxing overhead -nan%

Output file is created, but with 0 bytes:

$ ls -lh out.mpg
-rw-r--r-- 1 lou lou 0 Nov 22 10:42 out.mpg

The message could be something like: "Your -ss value exceeds the duration of your input. Aborting."

I don't know if multiple inputs with different durations would complicate things.

[1] http://ffmpeg.org/pipermail/ffmpeg-user/2011-November/003222.html
[2] http://ffmpeg.org/pipermail/ffmpeg-devel-irc/2011-November/000309.html (21:45)

Change History (3)

comment:1 by Carl Eugen Hoyos, 12 years ago

Component: undeterminedFFmpeg
Resolution: invalid
Status: newclosed

Given that the duration is plain wrong for many / most input streams, I don't think this is feasible but please reopen if you believe I miss something.

comment:2 by Michael Niedermayer, 12 years ago

It would be possible to print the warning after encoding if nothing was encoded due to -ss

comment:3 by llogan, 12 years ago

Resolution: invalidfixed

Thanks, michael. I consider this fixed with e1d48786d577976fb8bb87dcd89097e87d080cfd.

Note: See TracTickets for help on using tickets.