Reputation: 644
I am trying to convert a source VBR SPTS MPEG-2 TS file into CBR using ffmpeg. The code I am using is the following:
#!/bin/bash
pkill ffmpeg
ffmpeg \
-re -i source.ts -c copy \
-muxrate 18000K \
-f mpegts \
udp://destination_ip:1234?pkt_size=1316
The source VPID bitrate is ~ 10Mbps and the APID is 296Kbps. So according to my understanding this code should deliver 18Mbps CBR where the difference between the muxrate and the bitrate of all the PIDs is filled with null packets.
The problem is that the output is far from perfect. The overall bitrate is semi-CBR at best. It ranges between 12Mbps and 15Mbps and I see a lot of PCR accuracy and PCR repetition errors along with CC errors both on the VPID and APID.
Upvotes: 1
Views: 7434
Reputation: 11
-minrate
and -maxrate
too.-bufsize
bigger than bitrate
.-muxrate
value like bufsize
.The final command:
ffmpeg \
-re -i source.ts \
-b:v 10500k \
-minrate 10500k \
-maxrate 10500k \
-bufsize 18000k \
-muxrate 18000k \
-f mpegts \
udp://destination_ip:1234?pkt_size=1316
Upvotes: 1
Reputation: 31209
Some ideas:
ffmpeg
because at some point there was a bug which messed up PCR insertion when stream copyingif you want constant UDP output you must use the bitrate
option like:
-flush_packets 0 -f mpegts "udp://destination_ip:1234?pkt_size=1316&bitrate=18000000"
UDP
is an unreliable protocol and you might experience packet loss (unfortunately the bitrate
option only works for UDP
for now AFAIK)Upvotes: 4