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

Jonathan Viney jonathan.viney at gmail.com
Mon Oct 30 05:56:03 EET 2017


On Thu, Oct 5, 2017 at 7:48 PM, Carl Eugen Hoyos <ceffmpeg at gmail.com> 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?
>

In case anyone is interested, I used h264_analyze from
https://github.com/aizvorski/h264bitstream to parse the NAL units.

ffmpeg -rtsp_transport tcp -i rtsp://10.9.9.1:554/axis-media/media.amp
-loglevel
debug out.mp4
ffmpeg -i out.mp4 -c copy -vbsf h264_mp4toannexb -an -y out.mp4.h264
h264_analyze out.mp4.h264

The nal_unit_type of 7 is the SPS, and contains the values mentioned by
Mark.

Thanks,
-Jonathan.


More information about the ffmpeg-user mailing list