jaskie / Server

This fork of CasparCG Server contains enhancements used in broadcast play-out system used in TVP.
http://playoutautomation.tvp.pl
GNU General Public License v3.0
20 stars 4 forks source link

MPEGTS CBR #13

Open sfahadshahzad opened 2 years ago

sfahadshahzad commented 2 years ago

Hi,

Hope you are doing well and keeping safe.

I just checked on wiki page to create MPEGTS from casparcg which working perfectly fine ,

Now is it possible for you to giude me how I can generate same MPEGTS using ffmpeg with Decklink SDI.

here is my command but not getting CBR stream ffmpeg -hide_banner -loglevel info -threads 1 -f decklink -fflags +genpts -i 48:00000000:00300a00 -vcodec libx264 -profile:v main -preset veryfast -pix_fmt yuv420p -s 720x576 -r 25 -g 50 -keyint_min 12 -bf 3 -b_strategy 1 -crf 17 -b:v 4500k -minrate 4500k -maxrate 4500k -bufsize 1M -threads 16 -acodec aac -ar 48000 -b:a 128k -f mpegts -muxrate 5000k -flags cgop+ilme -sc_threshold 1000000000 udp://239.0.100.1:3000?pkt_size=1316

Regards,

Fahad

mairajha commented 2 years ago

ffmpeg -re -i [source] -vcodec mpeg2video -s 720x576 -r 25 -flags cgop+ilme -sc_threshold 1000000000 -b:v 2M -minrate:v 2M -maxrate:v 2M -bufsize:v 1.4M -acodec mp2 -ac 2 -b:a 192k -f mpegts udp://your ip adress:port?pkt_size=1316

Hope this help - if not then share details what exactly you want to achieve, e.g. streaming, encoding etc

--Mj

jaskie commented 2 years ago

The wiki page refers to specific FFmpeg build that includes pthreads, and then allows to specify bitrate in url: udp://239.1.1.1:10000?pkt_size=1316&bitrate=6450000 CBR in this case in only at total bitrate level, where not used TS packets are filled with null packets. So, IMHO, you should get such a FFmpeg build and specify bitrate parameter in output url to value that is slightly greater than sum of stream's bitrates. Pthread support is common in Linux builds, so you can test it on any Linux.

sfahadshahzad commented 2 years ago

ffmpeg -re -i [source] -vcodec mpeg2video -s 720x576 -r 25 -flags cgop+ilme -sc_threshold 1000000000 -b:v 2M -minrate:v 2M -maxrate:v 2M -bufsize:v 1.4M -acodec mp2 -ac 2 -b:a 192k -f mpegts udp://your ip adress:port?pkt_size=1316

Hope this help - if not then share details what exactly you want to achieve, e.g. streaming, encoding etc

--Mj

thank you for your kind response.

I want to stream video using SRT protocol and need to generate mpegts using decklink and feed into nimble streamer then push using SRT.

your command reference help me a lot but getting PCR accuracy errors on output and is there any way to get rid pcr errors.

Thanks

mairajha commented 2 years ago

What kind of error pls elaborate? You want to manipulate A/V PIDs i.e. PCR & PMT?

--Mj

sfahadshahzad commented 2 years ago

On a stream analyzer the Continuity Count Errors and PCR clock accuracy errors occurs

mairajha commented 2 years ago

PCR accuracy error incurred when a transmistted PCR value differs from what it is expecting e.g more than 500 nanoseconds - do you get any PCR overall jitter (PCR_OJ)? are you using any hardware encoder? if yes then give details about your hardware encoder (brand/model). If you are using software encoder then it will be more difficult as you can't change PIDs, PCR & PMT using software encoder

--Mj