gstreamer' frame rate setting is not in effect and total frame number of the target video is wrong.

Hello!

I am using gstreamer to do video conversion on Jetson Tx2. the source file is in MKV, which is essentially H.264. The target format is HEVC.

my source file is 1224x1024 and 10fps, there is no audio part.

I use the following cmd to do conversion,

gst-launch-1.0 filesrc location=212524.mkv ! matroskademux ! h264parse ! omxh264dec ! nvvidconv ! omxh265enc ! ‘video/x-h265,stream-format=(string)byte-stream, width=(int)1224, height=(int)1024, framerate=(fraction)10/1’ ! filesink location=test.h265

However, after conversion, once I play the test.h265 file, it is very fast and the fps become 25, which i get from OpenCV function: cv2.get(cv2.cap_prop_fps). The more serious problem is the total frame number become -192153584101141.0 which i get from cv2.get(cv2.cap_prop_frame_count)

if i right click the test.265 file to see the properties of the file, I see Duration: 0 seconds. Framerate: N/A bitrate: N/A

I am not sure where is wrong. I just want to know how to let frame rate in effect during conversion, which make sure the target file is at 10fps. And I need to get the right meta data from the video, such as total frames, since i need to use OpenCV to do later processing.

Hi,
The frame rate information is in container. Please mux it into mkv and check again:

gst-launch-1.0 filesrc location=212524.mkv ! matroskademux ! h264parse ! omxh264dec ! nvvidconv ! omxh265enc ! 'video/x-h265,stream-format=(string)byte-stream, width=(int)1224, height=(int)1024, framerate=(fraction)10/1' ! h265parse ! matroskamux ! filesink location=test.mkv

i found this way is faster. with and without nvvidconv has different speeds, but it does not impact the final output.

gst-launch-1.0 filesrc location=0548207774512179-1562693984106-20190709-down-173959.avi ! decodebin  ! omxh265enc ! 'video/x-h265,stream-format=(string)byte-stream, width=(int)1224, height=(int)1024, framerate=(fraction)10/1' ! h265parse ! matroskamux ! filesink location=new2.mkv