[FFmpeg-devel] TS muxer issues -- some progress

Alexandre FERRIEUX - FT/RD/SIRP/ASF/SOFTL alexandre.ferrieux
Fri Jan 30 10:16:46 CET 2009


Hi,

Recently I asked for help about ffmpeg's TS/UDP flow being unsuitable 
for a set-top-box. I precise I'm talking about the trunk's TS muxer, not 
the SoC one since it seems it is not blatantly superior ... yet ;-)

Thanks to ffmpeg's and vlc's flexibility, I have been able to perform 
the following comparison:

(1) Ffmpeg all the way (encode+mux+send):

    ./ffmpeg -re -i 134.wmv -vcodec mpeg2video -acodec mp2 -f mpegts 
udp://HOST:PORT\?pkt_size=1316

(2) Ffmpeg (encode) + Vlc (mux+send):

    ./ffmpeg -re -i 134.wmv -vcodec mpeg2video -acodec mp2 -f vob - | 
vlc - --sout '#std{access=udp,dst=HOST:PORT,mux=ts}'

The result is that (2) works like a charm with audio and video while (1) 
displays frequent freezes and mostly no sound.

Hence, clearly something goes awry in the (mux+send) of ffmpeg.

Then I used Laurent Aimar's vlc trick to separate the "send" part:

    vlc file.ts --ts-out HOST:PORT --ts-out-mtu 1500

I did this with two TS files, generated by each variant of the 
(encode+mux) chain:

    ./ffmpeg -re -i 134.wmv -vcodec mpeg2video -acodec mp2 -f mpegts bad.ts

    ./ffmpeg -re -i 134.wmv -vcodec mpeg2video -acodec mp2 -f vob - | 
vlc - --sout '#std{access=file,dst=good.ts,mux=ts}'

Interestingly, the outcome is the same: bad.ts has exactly the same 
misbehavior as the equivalent direct-udp-send chain above, while good.ts 
displays perfectly.

Conclusion: ffmpeg's TS mux is broken, independently from codec tunings 
or UDP-out timings.

Now I have superficially analyzed both TS files with dvbsnoop. The 
salient differences are:

    (1) Different version numbers in PAT and PMT: ffmpeg's are both 0, 
vlc's are 5 (PAT) and 7 (PMT)

    (2) Different pattern of presence of the adaptation field (hence 
PCR) in the video stream:

        - ffmpeg's are very regular, one PCR every three TS packets of 
the video PID => even-sized PESpackets ???

        - vlc's are more varied, with intervals ranging from 1 to more 
than 20, as one would expect.

    (3) Different delta-PCR:

        - ffmpeg's are mostly at 19ms

        - vlc's are mostly around 70ms


Does the above pattern of evidence ring a bell ?

-Alex






More information about the ffmpeg-devel mailing list