[FFmpeg-user] ffmpeg -i reports a video of length 03:17.53, but splitting into frames at 2 fps only results in one frame

Stéphane Chauveau stephane at chauveau-central.net
Tue Jul 16 21:38:01 EEST 2019


It seems that the pts value depends of the stream time_base so the 
formula 'N*30' is probably not valid in the general case.

So if FR is not available in you meg file then I propose the following:

Find the time_base value with

ffprobe -hide_banner -show_streams -select_streams v  input.mpg | grep 
time_base

For example, that could be 1/1000

Then use the formula 'N/(30*(1/1000))' assuming fps=30 and time_base=1/1000

If you get the right formula then the frame n=30 should have 
pts_time=1.00  in the showinfo dump.


On 7/16/19 7:28 PM, Stéphane Chauveau wrote:
> The documenation to setpts says that the FR value may is only defined 
> in constant frame-rate videos.
> If its does not exists in your mpeg file then you could try something 
> like 'setpts=N*30'
>
> ps: the -vf argument in the first command in my previous message was 
> supposed to be showideo (so without the setpts part).
>
>
> On 7/16/19 7:20 PM, Stéphane Chauveau wrote:
>> In your ffmpeg output, all frames have the same time=26:19:06.00 and 
>> that could indicate an overflow in the PTS (presentation time stamp) 
>> values probably because your video is part of a very long video stream.
>>
>> Add the filter showinfo to your command.
>>
>> ffmpeg -i input.mpg -vf  setpts='N*FR',showvideo  .......
>>
>> That should give out information about each decoded video frame. 
>> Something like that
>>
>> [Parsed_showinfo_0 @ 0x7f5e58cfe580] n: 122 pts:   3160 
>> pts_time:3.16    pos:   981301 fmt:yuv420p ...
>>
>> In a proper video, pts and pts_time are expected to be strictly 
>> increasing. If this is not the case then you could try to reassign 
>> the pts using the setpts filter.
>>
>> ffmpeg -i input.mpg  -vf  setpts='N*FR',showvideo   .......
>>
>> I am not sure that 'N*FR' is the appropriate formula. The idea is to 
>> recreate a pts value that makes sense. (N=the frame numeber, FR=the 
>> framerate).
>>
>> See http://ffmpeg.org/ffmpeg-all.html#setpts_002c-asetpts for the 
>> other variables that can be used in setpts.
>>
>> PS: When I use setpts=10000 on a valid video, I only get 1 output 
>> jpeg file so that tells me that a constant pts could be the problem 


More information about the ffmpeg-user mailing list