[FFmpeg-user] RTSP stream fps 29.97 instead of 30

Mark Thompson sw at jkqxz.net
Thu Oct 5 13:28:31 EEST 2017


On 05/10/17 07:48, Carl Eugen Hoyos wrote:
> 2017-10-04 23:20 GMT+02:00 Mark Thompson <sw at jkqxz.net>:
>> On 03/10/17 21:22, Jonathan Viney wrote:
>>> On Tue, Oct 3, 2017 at 1:56 PM, Mark Thompson <sw at jkqxz.net> wrote:
>>>
>>>> On 03/10/17 00:56, Jonathan Viney wrote:
> 
>>>> parameter-sets=Z2QAM6w0yAPABD/8BbgICAoAAAfSAAHUwdDAAGP/
>>>> gAAMf+Nd5caGAAMf/AAAY/8a7y4b04A=,aO48MA==
>>>>
>>>> This SPS in the SDP decodes with:
>>>>
>>>> @126   VUI: timing_info_present_flag                                 1 (
>>>> 1)
>>>> @127   VUI: num_units_in_tick
>>>> 00000000000000000000001111101001 (1001)
>>>> @159   VUI: time_scale
>>>>  00000000000000001110101001100000 (60000)
>>>> @191   VUI: fixed_frame_rate_flag                                    1 (
>>>> 1)
>>>>
>>>> That is, the H.264 stream indeed has a fixed framerate of 60000/1001/2 ~
>>>> 29.97fps, and that is what ffmpeg is reading - the RTSP layer is likely
>>>> lying about it.  (You may be able to count frames to check that.)
>>>>
>>>> If you want an exactly 30fps output then you should tell the camera to
>>>> generate a 30fps stream rather than the 30000/1001fps it currently is.
> 
>>> Thanks Mark. That's interesting, I'll see if there is a way to adjust the
>>> stream from the camera.
>>>
>>> How did you decode the data from the sprop-parameter-sets value?
>>
>> It's just the SPS and PPS base64 coded: decode the base64,
>> add start codes, feed it to any H.264 stream parser.
> 
> My question would have been:
> Where can I find any H.264 stream parser?

<http://ffmpeg.org/pipermail/ffmpeg-devel/2017-September/216249.html> - the trace_headers filter will generate traces like this.

Unfortunately that doesn't actually work for the stream fragment here because outer layers in ffmpeg don't like a stream containing no slices - I instead used the JM reference decoder in this case, which is happy to parse an isolated NAL unit.

- Mark


More information about the ffmpeg-user mailing list