[FFmpeg-user] Mpegts timing issues?

Daniel Price dprice at haivision.com
Thu Apr 12 22:32:31 CEST 2012

Hi Everyone;
 Thanks in advance to anyone that can help with this.
I have a set top box based on embedded code that I have to treat as a black
box. It's capable of playing an h.264/aac stream in an mpeg transport
stream. Normally we use a specific type of encoder to make streams for it.
I am trying to transcode files using ffmpeg, that are then multicast onto
the network, which this STB ingests, decodes, and plays to a TV. I've
gotten it *extremely* close to working, but I'm left with one standing
issue. The audio plays at the wrong frequency, and it stutters. This seems
to be related to the PCR/PTS timestamps on the stream, but I'm not certain.
 Now for the TL;DR. I know that the codecs themselves are not the issue.
The STB will play the video perfectly, and I've used aac audio with the
same settings (128Kb,48k rate) before in working cases. I've been comparing
against a reference TS stream that I know works, which has valid PTS values
on the audio PID, on the PES packets. I'm checking the working against the
non-working streams in Elecard's Stream Analyzer, and this is the major
discrepancy that I've come up with. In my reference (working) stream, a PES
packet is delivered every ~20ms. In the other, ~300ms. I cannot figure out
any way to adjust this from the ffmpeg cli, and have tried both libfaac and
aac encoders to see if it makes a difference. I'm not good enough at C to
dig through the code and figure out how it's deciding to packetize the
audio during the mux.
 I have heard there's issues with getting mpegts to mux a CBR, but that's
not an issue here. I can handle VBR on this set top. I just need more
granular timestamps on the stream packets to get the decoder to play the
audio nicely.
 So: Is there any way to get the mux to generate PES timestamps more often,
or to control that somehow? I've spent two days searching and have not
found a solution.
I'm adding the best working of the CLI commands for reference here, if
anyone needs to try to repro. I'm using the Sintel trailer as a test asset,
since it is easily acquirable. I can provide reference assets if anyone
 ffmpeg -y -i sintel_trailer-1080p.mp4 -f mpegts -vcodec libx264
-bufsize 4M -maxrate 3000k -bf 0 -g 60 -keyint_min 20 -coder 0 -acodec aac
-ab 128k -ar 48k -strict experimental linux_ffmpeg/sintel_trailer2.ts

Thanks again.
Daniel Price

More information about the ffmpeg-user mailing list