When rendering a real-time camera, I use ffmpeg to process a large video file(like 4G or even larger) at the same time. I noticed that the video frames are buffering and stuttering.
Pipeline:
DISPLAY=:0 gst-launch-1.0 filesrc location=/home/user/jellyfish-120-mbps-4k-uhd-hevc-10bit.mkv ! matroskademux name=demux demux.video_0 ! queue ! h265parse ! nvv4l2decoder ! nvvidconv ! xvimagesink
FFmpeg command:
ffmpeg -i ${file_name} -c copy -f segment -segment_time 600 -segment_format_options movflags=+faststart -reset_timestamps 1 ./${file_name}_%02d.mp4 -y
And there are some warning indicated that “a lot of buffers are being dropped” duration stuttering. pipeline warning picture
The requirement can be summarized as “real-time video rendering has higher priority, and the low rate of large file processing is accepted”, are there any possible solutions of this issue from your perspective? Thanks in advance.
its a hunch but not at the same time. probably your processor/ram is getting overloaded which in turn reduces your gstreamer pipeline's priority which reduces the resources invested in it which slows down your pipeline resulting in bad output timestamps (according to the error message). there are two easy ways to fix it:
reduce the resolution that is being output of either process to SD or HD as 4K resolution is very resource heavy
in your ffmpeg cmd add the -re flag before -i flag which will force ffmpeg to read the file at its actual framerate and encode accordingly but the drawback to this is if your file is 1 hr long then it will take about 1 hour to encode but it will drastically reduce the processor/gpu usage in turn letting your gst pipeline use as many resources as possible
p.s also try increasing process priority of your gst pipeline first either in system monitor/taskmanager or using nice (linux only) but again it may slow down your ffmpeg proc.
hope i could help