[FFmpeg-user] How to effectly record and encode from udp stream(4K HECV) in real time?

MEISA 610878158 at qq.com
Fri Jan 22 09:09:45 EET 2021

I have a serious problem to solve.
My task is to record from udp stream(4K HECV) and encode it to a mxf file.
My CPU is Intel(R) Xeon(R) Gold 5122 CPU at 3.60GHz

The situation of the udp stream:

The ffmpeg I used from https://github.com/BtbN/FFmpeg-Builds/commit/86af523883173be93c69d1170d1f78f79dc5e9f8 .
The command I used is:
ffmpeg -y -threads 6 -i "udp://@" -threads 32 -qscale:v 2 -alternate_scan 1 -f mxf "G:\4k.xmf"

Now the speed is lower than 1.0x after running for a while(about 10minutes). Maybe this is due to the temperature of the cpu gradually increasing.
The picture above displays the performance of CPU when we specify threads=6 for decoding and threads=32 for encoding.
I found that the speed would be 1.0x if I just recorded it to a .hecv file. But now I want to encode the stream to a .mxf file in real time. But as you can see, if I tried to encode it in real time, the speed of decoding and encoding would always be lower than 1.0x (around 0.98x). After running this command for about 3 hours, the recording and encoding process will be stopped.

How to solve it? I expect that the speed is 1.0x by speeding up encoding or other ways. 
Or anyone knows that how to record the udp stream without re-encoding to a .hecv file and meanwhile encode the .hecv file to a .mxf file? 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 590E0562 at 45F3D718.397A0A60.png.jpg
Type: image/jpeg
Size: 91257 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-user/attachments/20210122/3eb5bdd9/attachment.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 2ACF923C at E552D635.397A0A60.png.jpg
Type: image/jpeg
Size: 14436 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-user/attachments/20210122/3eb5bdd9/attachment-0001.jpg>

More information about the ffmpeg-user mailing list