Opened 11 years ago

Closed 11 years ago

#2838 closed defect (duplicate)

Mpeg TS sample plays with lots of artifacts with ffplay (mplayer ok)

Reported by: Alexis Ballier Owned by:
Priority: normal Component: avformat
Version: git-master Keywords: mpegts
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug: Here is a sample that plays awfully with ffplay. mplayer is fine.

How to reproduce:

% ffplay BDAV\ recorded\ video\ sample.ts 
ffplay version N-55317-g7565aae Copyright (c) 2003-2013 the FFmpeg developers
  built on Aug  6 2013 12:20:06 with gcc 4.8.1 (Gentoo 4.8.1 p1.0, pie-0.5.6)
  configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --enable-shared --cc=x86_64-pc-linux-gnu-gcc --cxx=x86_64-pc-linux-gnu-g++ --ar=x86_64-pc-linux-gnu-ar --optflags='-march=native -mssse3 -msse4 -msse4.1 -msse4.2 -mavx -maes -O2 -pipe -ggdb3' --extra-cflags='-march=native -mssse3 -msse4 -msse4.1 -msse4.2 -mavx -maes -O2 -pipe -ggdb3' --extra-cxxflags='-march=native -mssse3 -msse4 -msse4.1 -msse4.2 -mavx -maes -O2 -pipe -ggdb3' --disable-static --enable-gpl --enable-postproc --enable-avfilter --enable-avresample --disable-stripping --enable-version3 --enable-nonfree --disable-indev=oss --disable-outdev=oss --enable-version3 --enable-bzlib --disable-runtime-cpudetect --disable-debug --disable-doc --enable-gnutls --enable-hardcoded-tables --enable-iconv --enable-network --disable-openssl --enable-ffplay --enable-vaapi --enable-vdpau --enable-zlib --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libmp3lame --enable-libfdk-aac --enable-libaacplus --disable-libfa  libavutil      52. 41.100 / 52. 41.100
  libavcodec     55. 22.100 / 55. 22.100
  libavformat    55. 13.102 / 55. 13.102
  libavdevice    55.  3.100 / 55.  3.100
  libavfilter     3. 82.100 /  3. 82.100
  libavresample   1.  1.  0 /  1.  1.  0
  libswscale      2.  4.100 /  2.  4.100
  libswresample   0. 17.103 /  0. 17.103
  libpostproc    52.  3.100 / 52.  3.100
    Last message repeated 2 times  0KB vq=    0KB sq=    0B f=0/0   
[mpegts @ 0x7f7ccc000b20] Could not detect TS packet size, defaulting to non-FEC/DVHS
[mpegts @ 0x7f7ccc000b20] PES packet size mismatch                                                                                                                                                                                                                             
    Last message repeated 1 times
[h264 @ 0x7f7ccc001080] non-existing SPS 0 referenced in buffering period
[h264 @ 0x7f7ccc001080] non-existing PPS referenced
[h264 @ 0x7f7ccc001080] non-existing SPS 0 referenced in buffering period
[h264 @ 0x7f7ccc001080] non-existing PPS 0 referenced
[h264 @ 0x7f7ccc001080] decode_slice_header error
[h264 @ 0x7f7ccc001080] non-existing PPS 0 referenced
...

Sample available here: http://dev.gentoo.org/~aballier/BDAV%20recorded%20video%20sample.ts

mplayer plays it nicely, so maybe the ts demuxer is at fault.

please tell me if you need more information, I have not analyzed the bug much more than this.

Change History (3)

comment:1 by Alexis Ballier, 11 years ago

Summary: Mpeg TS plays with lots of artifacts with ffplay (mplayer ok)Mpeg TS sample plays with lots of artifacts with ffplay (mplayer ok)

comment:2 by Alexis Ballier, 11 years ago

with this hack:

diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 15a5d2f..9661b27 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -454,7 +454,7 @@ static int analyze(const uint8_t *buf, int size, int packet_size, int *index){
     memset(stat, 0, packet_size*sizeof(int));
 
     for(x=i=0; i<size-3; i++){
-        if(buf[i] == 0x47 && !(buf[i+1] & 0x80) && buf[i+3] != 0x47){
+        if(buf[i] == 0x47) { // && !(buf[i+1] & 0x80) && buf[i+3] != 0x47){
             stat[x]++;
             if(stat[x] > best_score){
                 best_score= stat[x];

the file is detected as dvhs and plays correctly

comment:3 by Carl Eugen Hoyos, 11 years ago

Component: undeterminedavformat
Keywords: mpegts added
Resolution: duplicate
Status: newclosed

Duplicate of ticket #1812, workaround is to use -skip_initial_bytes 400k.

Note: See TracTickets for help on using tickets.