TS mux cuts large video frames short (not unbounded PES)

About encoding, codec settings, muxers and filter usage
MASHtm
New Cone
New Cone
Posts: 8
Joined: 18 Sep 2008 20:45

TS mux cuts large video frames short (not unbounded PES)

Postby MASHtm » 11 Oct 2014 17:07

Hi!

We do some livestreaming with VLC to Wowza over RTP. We call VLC with

Code: Select all

vlc -I dummy <....source options....> :sout="#transcode{venc=x264{keyint=25,profile=baseline,crf=26},width=800,height=600,vcodec=h264,scale=1,fps=25,acodec=mp4a,ab=128,channels=2,samplerate=44100,audio-sync}:rtp{mux=ts,dst=<destination-ip>,port=20071}"
We recognized some broken videoframes over the time. They were damaged in the lower part as if the keyframes were cut short. We finally found some time to debug that and found that if we lower crf we can force VLC to produce even more broken frames, even if we stream on loopback and watch it with VLC on the same machine without involving Wowza. Finaly we used:

Code: Select all

vlc.exe -vvv -I dummy <....any .mp4.....> :sout="#transcode{venc=x264{keyint=25,profile=baseline,crf=15,verbose=1},width=800,height=600,vcodec=h264,scale=1,fps=25,acodec=mp4a,ab=128,channels=2,samplerate=44100,audio-sync}:rtp{mux=ts,dst=127.0.0.1,port=20071}"
Every time x264 outputs a frame larger the ~64k (or PES_PAYLOAD_SIZE_MAX - some overhead) the videoframe is damaged (cut short).

Looking into the code at modules/mux/mpeg/ts.h:MuxStreams() shows that

Code: Select all

i_max_pes_size = INT_MAX;
is only set for VLC_CODEC_DIRAC, but modules/mux/mpeg/pes.c:EStoPES(), which is called by MuxStreams() mentions

Code: Select all

* EStoPES will only produce an unbounded PES packet if: * - ES is VIDEO_ES * - i_max_pes_size > PES_PAYLOAD_SIZE_MAX * - length of p_es > PES_PAYLOAD_SIZE_MAX
I added a check for VLC_CODEC_H264 to set i_max_pes_size to INT_MAX as well and it seems to fix our specific H264 troubles. Did I do the right thing? If yes, I think a broader check for VIDEO_ES should be added to MuxStreams()?

I was able to reproduce this beahviour up to 2.1.5.

Greetings,
MASHtm

Return to “VLC stream-output (sout)”

Who is online

Users browsing this forum: No registered users and 4 guests