Pb with fps with mp4mux

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Pb with fps with mp4mux

Guillaume CLODIC
Hi,

i have a rtp h264 encoder with an 1080i (yes interlaced) SDI input.

When i save the stream as a raw ts file with the following command :

  gst-launch-1.0 -e -v udpsrc port=46234 ! filesink location=file.ts

i then check the file with ffprobe and it says me that the fps is 25 (ok
europe standard) and 50 tbc

when i try to save the file as mp4 with this :

  gst-launch-1.0 -e -v udpsrc port=46234 ! tsdemux ! video/x-h264 !
queue ! h264parse ! mp4mux ! filesink location=file.mp4

with ffprobe fps is 49.38 (or .60 or else) tbc is 50 and the file cannot
be imported in professionnal movie editors such adobe premiere.

does anyone as an idea how to obtain a mp4 file with the correct fps (ie
25) ?

Regards,

Guillaume.


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Pb with fps with mp4mux

David Ing
Your pipeline is basically moving h.264 packets from the udpsrc into the mp4 file.

Unfortunately, you cannot modify the framerate by dropping some of the h.264 packets.  You need to actually decode the video to drop frames.

You need to decode the video/x-h264 stream into video/x-raw, then re-encode with an h.264 encoder.  Some h.264 encoders allow you to set the framerate but some don't.  If you don't set the framerate on the encoder, you can add some extra elements before going into the encoder.  Specifically you would use a videoconvert element followed by a caps filter which specifies the framerate, and then (a queue and) the h.264 encoder.

On Tue, Dec 3, 2019 at 6:34 AM Guillaume CLODIC <[hidden email]> wrote:
Hi,

i have a rtp h264 encoder with an 1080i (yes interlaced) SDI input.

When i save the stream as a raw ts file with the following command :

  gst-launch-1.0 -e -v udpsrc port=46234 ! filesink location=file.ts

i then check the file with ffprobe and it says me that the fps is 25 (ok
europe standard) and 50 tbc

when i try to save the file as mp4 with this :

  gst-launch-1.0 -e -v udpsrc port=46234 ! tsdemux ! video/x-h264 !
queue ! h264parse ! mp4mux ! filesink location=file.mp4

with ffprobe fps is 49.38 (or .60 or else) tbc is 50 and the file cannot
be imported in professionnal movie editors such adobe premiere.

does anyone as an idea how to obtain a mp4 file with the correct fps (ie
25) ?

Regards,

Guillaume.


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Pb with fps with mp4mux

Guillaume CLODIC
Hi,

i do not want to modify the framerate of the original stream (which is 25
fps). I only want that my mp4 file to have the correct framerate : 25 fps
and not 49.36 or 99/2 according to gst-discovery.

why the mp4mux does not set the correct framerate ? (the caps for the src
pad of the muxer says fps is 25).



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Pb with fps with mp4mux

David Ing
There is no way for a muxer to control the frame-rate when you have h.264 frames.  Except for the keyframes, all of the h.264 frames are defined in terms of a change with respect to adjacent frames.  So if you remove one h.264 frame, you destroy the information required to generate many adjacent frames (in most cases).  This is why it is necessary to convert (decode) the signal to video/x-raw, so you CAN remove individual frames; and then convert (re-encode) back to video/x-h264.

On Wed, Dec 4, 2019 at 12:45 AM Guillaume CLODIC <[hidden email]> wrote:
Hi,

i do not want to modify the framerate of the original stream (which is 25
fps). I only want that my mp4 file to have the correct framerate : 25 fps
and not 49.36 or 99/2 according to gst-discovery.

why the mp4mux does not set the correct framerate ? (the caps for the src
pad of the muxer says fps is 25).



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Pb with fps with mp4mux

alxg
Well you dont have to transcode the video if you can afford a secondary "post
processing stage"
After each recording you can remux it as discussed here:
https://superuser.com/a/1291513 <https://superuser.com/a/1291513>  
In your case run these two commands:
ffmpeg -i file.mp4  -c:v copy test.h264
ffmpeg -r 25 -i test.h264 -c:v copy test.mp4

If you run ffprobe on test.mp4 you will see 25.00fps

I have the same issue with mp4mux and incoming h264 frames and so far I have
not found a Gstreamer based solution



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Pb with fps with mp4mux

Guillaume CLODIC
My first goal using GStreamer was to avoid the secondary processing stage (i
use ffmpeg before).

This is really bizarre as it works justs fine with a 1080p30 video but not
with a 1080i50 video.

Guillaume.



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel