[vlc-devel] Problem with wrong (input) timestamp presentations and TS muxer
Enrique Arizón Benito
enrique.arizonbenito at gmail.com
Mon Dec 16 17:23:15 CET 2013
Hello,
I'm using VLC to stream and transcode properly a set of TV channels in
parallel. The input is taken from the DVB-T card and at this moment I have
managed to make it works fine transcoding "N" channels in parallel using a
normal PC. The output quality is really good and the software is very
stable (no crashes after hours/days of usage).
Now comes my problem. While testing with different channel sources I have
found that about 1 of each 30 channels is not properly encoded due to a
problem in the source. The TS muxer complain that some packets have a PTS
incorrect (< DTS) and it drops the packet. Curiously VLC is able to play
the original stream properly but the transcoded one is very "buggy" since
lot of packets are dropped and VLC can't manage to reconstruct the video.
Browsing the ts code I found that next "draft-patch" fix the problem, since
it ignores the error and just dump all packets to the output. I don't
exactly know why ts choose to drop the packets but I guess that there must
be a good reason and the proper solution must be somewhere else in the
transcoding chain.
diff --git a/modules/mux/mpeg/ts.c b/modules/mux/mpeg/ts.c
index d514f5c..389585d 100644
--- a/modules/mux/mpeg/ts.c
+++ b/modules/mux/mpeg/ts.c
@@ -1308,14 +1308,15 @@ static bool MuxStreams(sout_mux_t *p_mux )
VLC_CODEC_SUBT )
p_data->i_length = 1000;
- if( ( p_pcr_stream->i_pes_dts > 0 &&
+ if(false && ( ( p_pcr_stream->i_pes_dts > 0 &&
p_data->i_dts - 10000000 > p_pcr_stream->i_pes_dts +
p_pcr_stream->i_pes_length ) ||
p_data->i_dts < p_stream->i_pes_dts ||
( p_stream->i_pes_dts > 0 &&
p_input->p_fmt->i_cat != SPU_ES &&
p_data->i_dts - 10000000 > p_stream->i_pes_dts +
- p_stream->i_pes_length ) )
+ p_stream->i_pes_length )
+ ))
{
msg_Warn( p_mux, "packet with too strange dts "
"(dts=%"PRId64",old=%"PRId64",pcr=%"PRId64")",
If anyone is also interested in this issue a test file for testing can be
downloaded at: http://46.105.6.148/DR3.ts
The script I use for testing is similar to:
FPS="25" # "25.00" "26.63" "53.26" "54.00"
OPTS=" --sout-ts-shaping 40 "
WIDTH="480"
HEIGHT="320"
VLC="/opt/custom_vlc_compilation/vlc"
QUIT_AFTER_END="vlc://quit"
INPUT="./DR3.ts" # h264 (High), yuv420p, 1280x720 [PAR 1:1 DAR 16:9], 50
fps, 50 tbr, 90k tbn, 100 tbc
OUTPUT="transcoded_test.ts"
VERBOSITY="-v" # Verbosity level
EXTERNAL_IP="192.168.1.12"
if true ; then
SOUT="" # Stream Output Transcodage (SOUT) options
SOUT="${SOUT}#transcode{threads=1,fps=${FPS},vcodec=h264,vb=410,vecn=x264{aud,profile=baseline,crf=30},acodec=mp4a,ab=92,channels=2,samplerate=48000,pid-audio=230,height=${HEIGHT},width=${WIDTH},interlace}"
SOUT="${SOUT}:duplicate{"
SOUT="${SOUT}dst=std{"
SOUT="${SOUT}access=file,"
SOUT="${SOUT}mux=ts,"
SOUT="${SOUT}dst=${OUTPUT},"
SOUT="${SOUT}}"
SOUT="${SOUT}}"
fi
${VLC} --no-ps-trust-timestamps ${VERBOSITY} ${OPTS} -I dummy ${INPUT}
${QUIT_AFTER_END} --sout "${SOUT}"
Best Regards,
Enrique
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20131216/63f812e6/attachment.html>
More information about the vlc-devel
mailing list