Opened 2 years ago

Closed 3 months ago

#1398 closed defect (fixed)

remuxed DTS audio won't play on hardware devices

Reported by: patters Owned by:
Priority: normal Component: avformat
Version: git-master Keywords: dca mpegts
Cc: iuqbgq9h-1@yahoo.com, goodthanks Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Hi,

Firstly thanks for FFmpeg, it's an incredible tool. My interest in it comes from using the DLNA server Serviio which uses FFmpeg for its transcoding and remuxing. Many renderer devices don't support Matroska files but the streams they contain are often supported, so it's common to remux to mpeg-ts. I maintain the Serviio device profile for Sony Bluray and Network Media Players:
http://forum.serviio.org/viewtopic.php?f=11&t=2004

I would like to report an issue with DTS audio streams that are remuxed into mpeg-ts by FFmpeg. The resulting files fail to play on many consumer electronics products which do officially support DTS, in my case Sony Bluray players, though I can see from the Serviio forum that it's also an issue for people who use AV receivers to decode the DTS stream.

The files that FFmpeg produces play with silent audio on the affected devices, but they do play ok in VLC and Media Player Classic Home Cinema. I have observed this problem now for quite some time (maybe 18 months or so). I have reproduced this using the latest win32 build I could find from Zeranoe - ffmpeg-20120601-git-8a0efa9-win32-static.7z

The remux command line that Serviio would issue is as follows:

ffmpeg -i "/volume1/public/video/Movies/The.Good.The.Bad.And.The.Ugly.EXTENDED.1966.BluRay.720p.DTS.x264-FSiHD.mkv" -y -async 1 -vcodec copy -vbsf h264_mp4toannexb -copyts -acodec copy -map 0:0 -map 0:1 -sn -f mpegts /volume1/@tmp/Serviio/transcoding-temp-1086-10-ORIGINAL.stf

The problem is not limited to my choice of example clip - I have found it to be consistent with all MKV files containing DTS audio.

By contrast, the closed source utility tsMmuxeR is able to remux the same test clip in a way that plays perfectly on all systems I have tested. I shall attach 10MB clips of the original file, the FFmpeg non-working remux, and the TSmuxer working remux so that they may be analysed and compared.

Hopefully this could lead to a fix, as it doesn't seem that this issue has been reported.

Thanks,

Patters

Attachments (3)

patchticket1398.diff (314 bytes) - added by cehoyos 11 months ago.
0001-adtsenc-signal-mpeg-2-aac.patch (848 bytes) - added by heleppkes 11 months ago.
To the original issue, attached patch can be tried, it solved a similar issue for me at some point. The problem was not the DTS itself, but the ADTS muxing in MPEG-TS.
patchdts8a.diff (538 bytes) - added by cehoyos 3 months ago.

Download all attachments as: .zip

Change History (41)

comment:1 Changed 2 years ago by patters

I made my example files 10MB as per the guidelines here http://ffmpeg.org/bugreports.html
They can't be attached via the bug tracker as they're too big, so I have uploaded them to upload.ffmpeg.org/incoming.

comment:2 Changed 2 years ago by cehoyos

  • Keywords mpegts added; audio remux removed
  • Version changed from unspecified to git-master

Complete, uncut console output missing.

Do I understand correctly that the problem is only reproducible with hardware receivers, not with software?

comment:3 Changed 2 years ago by patters

Yes, it does seem to be hardware only. Sony PS3, Sony Bluray/Network Media Player, plus I believe it was reported on some receivers (can't find links to that on the forum at the moment).

I have checked with Serviio's developer and he can't recall specifically why the "-async 1" and "-copyts" options were used, though they relate to audio sync (Serviio has evolved gradually since 2009). I have re-run the test without them, and the issue remains.

According to the Zeranoe site the Win32 build I used was compiled from the Git head only four days ago. Do I really have to get the whole thing compiled from the up-to-the-minute source? I'm not a developer, so that's not completely trivial for me.

Here is the console output:

ffmpeg version N-41195-g8a0efa9 Copyright (c) 2000-2012 the FFmpeg developers
  built on May 31 2012 20:04:59 with gcc 4.6.3
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-runtime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libass --enable-libcelt --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libnut --enable-libopenjpeg --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libutvideo --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      51. 55.100 / 51. 55.100
  libavcodec     54. 23.100 / 54. 23.100
  libavformat    54.  6.101 / 54.  6.101
  libavdevice    54.  0.100 / 54.  0.100
  libavfilter     2. 77.100 /  2. 77.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
[matroska,webm @ 01dad6e0] Format matroska,webm probed with size=2048 and score=100
st:0 removing common factor 1000000 from timebase
st:1 removing common factor 1000000 from timebase
st:2 removing common factor 1000000 from timebase
st:3 removing common factor 1000000 from timebase
st:4 removing common factor 1000000 from timebase
st:5 removing common factor 1000000 from timebase
st:6 removing common factor 1000000 from timebase
st:7 removing common factor 1000000 from timebase
st:8 removing common factor 1000000 from timebase
st:9 removing common factor 1000000 from timebase
st:10 removing common factor 1000000 from timebase
st:11 removing common factor 1000000 from timebase
st:12 removing common factor 1000000 from timebase
st:13 removing common factor 1000000 from timebase
st:14 removing common factor 1000000 from timebase
st:15 removing common factor 1000000 from timebase
st:16 removing common factor 1000000 from timebase
[matroska,webm @ 01dad6e0] File position before avformat_find_stream_info() is 8128
[h264 @ 02b4bc20] no picture 
[dca @ 02b51ae0] Stream with high frequencies VQ coding
[h264 @ 02b4bc20] no picture 
[matroska,webm @ 01dad6e0] All info found
[matroska,webm @ 01dad6e0] File position after avformat_find_stream_info() is 41206
Input #0, matroska,webm, from 'U:\video\Movies\The.Good.The.Bad.And.The.Ugly.EXTENDED.1966.BluRay.720p.DTS.x264-FSiHD.mkv':
  Metadata:
    creation_time   : 2009-04-08 15:26:30
  Duration: 02:58:41.68, start: 0.000000, bitrate: 6343 kb/s
    Chapter #0.0: start 0.000000, end 177.386000
    Metadata:
      title           : 00:00:00.000
    Chapter #0.1: start 177.386000, end 362.195000
    Metadata:
      title           : 00:02:57.386
    Chapter #0.2: start 362.195000, end 905.905000
    Metadata:
      title           : 00:06:02.195
    Chapter #0.3: start 905.905000, end 1048.214000
    Metadata:
      title           : 00:15:05.905
    Chapter #0.4: start 1048.214000, end 1318.359000
    Metadata:
      title           : 00:17:28.214
    Chapter #0.5: start 1318.359000, end 1479.353000
    Metadata:
      title           : 00:21:58.359
    Chapter #0.6: start 1479.353000, end 1669.710000
    Metadata:
      title           : 00:24:39.353
    Chapter #0.7: start 1669.710000, end 1784.783000
    Metadata:
      title           : 00:27:49.710
    Chapter #0.8: start 1784.783000, end 1927.759000
    Metadata:
      title           : 00:29:44.783
    Chapter #0.9: start 1927.759000, end 2299.923000
    Metadata:
      title           : 00:32:07.759
    Chapter #0.10: start 2299.923000, end 2496.452000
    Metadata:
      title           : 00:38:19.923
    Chapter #0.11: start 2496.452000, end 2980.186000
    Metadata:
      title           : 00:41:36.452
    Chapter #0.12: start 2980.186000, end 3237.693000
    Metadata:
      title           : 00:49:40.186
    Chapter #0.13: start 3237.693000, end 3441.605000
    Metadata:
      title           : 00:53:57.693
    Chapter #0.14: start 3441.605000, end 3961.207000
    Metadata:
      title           : 00:57:21.605
    Chapter #0.15: start 3961.207000, end 4416.412000
    Metadata:
      title           : 01:06:01.207
    Chapter #0.16: start 4416.412000, end 4954.741000
    Metadata:
      title           : 01:13:36.412
    Chapter #0.17: start 4954.741000, end 5363.608000
    Metadata:
      title           : 01:22:34.741
    Chapter #0.18: start 5363.608000, end 5730.141000
    Metadata:
      title           : 01:29:23.608
    Chapter #0.19: start 5730.141000, end 5904.482000
    Metadata:
      title           : 01:35:30.141
    Chapter #0.20: start 5904.482000, end 6423.500000
    Metadata:
      title           : 01:38:24.482
    Chapter #0.21: start 6423.500000, end 6796.540000
    Metadata:
      title           : 01:47:03.500
    Chapter #0.22: start 6796.540000, end 7018.303000
    Metadata:
      title           : 01:53:16.540
    Chapter #0.23: start 7018.303000, end 7562.555000
    Metadata:
      title           : 01:56:58.303
    Chapter #0.24: start 7562.555000, end 7856.265000
    Metadata:
      title           : 02:06:02.555
    Chapter #0.25: start 7856.265000, end 8258.041000
    Metadata:
      title           : 02:10:56.265
    Chapter #0.26: start 8258.041000, end 8632.582000
    Metadata:
      title           : 02:17:38.041
    Chapter #0.27: start 8632.582000, end 9170.912000
    Metadata:
      title           : 02:23:52.582
    Chapter #0.28: start 9170.912000, end 9568.392000
    Metadata:
      title           : 02:32:50.912
    Chapter #0.29: start 9568.392000, end 9795.536000
    Metadata:
      title           : 02:39:28.392
    Chapter #0.30: start 9795.536000, end 10136.960000
    Metadata:
      title           : 02:43:15.536
    Chapter #0.31: start 10136.960000, end 10721.687000
    Metadata:
      title           : 02:48:56.960
    Stream #0:0(eng), 3, 1/1000: Video: h264 (High), yuv420p, 1280x544, 104271/5000000, SAR 1:1 DAR 40:17, 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
    Stream #0:1(eng), 16, 1/1000: Audio: dts (DTS), 48000 Hz, 5.1(side), s16, 1536 kb/s (default)
    Stream #0:2(eng), 0, 1/1000: Subtitle: text (default)
    Stream #0:3(dut), 0, 1/1000: Subtitle: text
    Stream #0:4(fre), 0, 1/1000: Subtitle: text
    Stream #0:5(dan), 0, 1/1000: Subtitle: text
    Stream #0:6(fin), 0, 1/1000: Subtitle: text
    Stream #0:7(nor), 0, 1/1000: Subtitle: text
    Stream #0:8(swe), 0, 1/1000: Subtitle: text
    Stream #0:9(por), 0, 1/1000: Subtitle: text
    Stream #0:10(slo), 0, 1/1000: Subtitle: text
    Stream #0:11(tur), 0, 1/1000: Subtitle: text
    Stream #0:12(kro), 0, 1/1000: Subtitle: text
    Stream #0:13(cze), 0, 1/1000: Subtitle: text
    Stream #0:14(est), 0, 1/1000: Subtitle: text
    Stream #0:15(hun), 0, 1/1000: Subtitle: text
    Stream #0:16(pol), 0, 1/1000: Subtitle: text
[mpegts @ 02f00060] muxrate VBR, pcr every 2 pkts, sdt every 200, pat/pmt every 40 pkts
Output #0, mpegts, to 'd:\output.m2ts':
  Metadata:
    creation_time   : 2009-04-08 15:26:30
    encoder         : Lavf54.6.101
    Chapter #0.0: start 0.000000, end 177.386000
    Metadata:
      title           : 00:00:00.000
    Chapter #0.1: start 177.386000, end 362.195000
    Metadata:
      title           : 00:02:57.386
    Chapter #0.2: start 362.195000, end 905.905000
    Metadata:
      title           : 00:06:02.195
    Chapter #0.3: start 905.905000, end 1048.214000
    Metadata:
      title           : 00:15:05.905
    Chapter #0.4: start 1048.214000, end 1318.359000
    Metadata:
      title           : 00:17:28.214
    Chapter #0.5: start 1318.359000, end 1479.353000
    Metadata:
      title           : 00:21:58.359
    Chapter #0.6: start 1479.353000, end 1669.710000
    Metadata:
      title           : 00:24:39.353
    Chapter #0.7: start 1669.710000, end 1784.783000
    Metadata:
      title           : 00:27:49.710
    Chapter #0.8: start 1784.783000, end 1927.759000
    Metadata:
      title           : 00:29:44.783
    Chapter #0.9: start 1927.759000, end 2299.923000
    Metadata:
      title           : 00:32:07.759
    Chapter #0.10: start 2299.923000, end 2496.452000
    Metadata:
      title           : 00:38:19.923
    Chapter #0.11: start 2496.452000, end 2980.186000
    Metadata:
      title           : 00:41:36.452
    Chapter #0.12: start 2980.186000, end 3237.693000
    Metadata:
      title           : 00:49:40.186
    Chapter #0.13: start 3237.693000, end 3441.605000
    Metadata:
      title           : 00:53:57.693
    Chapter #0.14: start 3441.605000, end 3961.207000
    Metadata:
      title           : 00:57:21.605
    Chapter #0.15: start 3961.207000, end 4416.412000
    Metadata:
      title           : 01:06:01.207
    Chapter #0.16: start 4416.412000, end 4954.741000
    Metadata:
      title           : 01:13:36.412
    Chapter #0.17: start 4954.741000, end 5363.608000
    Metadata:
      title           : 01:22:34.741
    Chapter #0.18: start 5363.608000, end 5730.141000
    Metadata:
      title           : 01:29:23.608
    Chapter #0.19: start 5730.141000, end 5904.482000
    Metadata:
      title           : 01:35:30.141
    Chapter #0.20: start 5904.482000, end 6423.500000
    Metadata:
      title           : 01:38:24.482
    Chapter #0.21: start 6423.500000, end 6796.540000
    Metadata:
      title           : 01:47:03.500
    Chapter #0.22: start 6796.540000, end 7018.303000
    Metadata:
      title           : 01:53:16.540
    Chapter #0.23: start 7018.303000, end 7562.555000
    Metadata:
      title           : 01:56:58.303
    Chapter #0.24: start 7562.555000, end 7856.265000
    Metadata:
      title           : 02:06:02.555
    Chapter #0.25: start 7856.265000, end 8258.041000
    Metadata:
      title           : 02:10:56.265
    Chapter #0.26: start 8258.041000, end 8632.582000
    Metadata:
      title           : 02:17:38.041
    Chapter #0.27: start 8632.582000, end 9170.912000
    Metadata:
      title           : 02:23:52.582
    Chapter #0.28: start 9170.912000, end 9568.392000
    Metadata:
      title           : 02:32:50.912
    Chapter #0.29: start 9568.392000, end 9795.536000
    Metadata:
      title           : 02:39:28.392
    Chapter #0.30: start 9795.536000, end 10136.960000
    Metadata:
      title           : 02:43:15.536
    Chapter #0.31: start 10136.960000, end 10721.687000
    Metadata:
      title           : 02:48:56.960
    Stream #0:0(eng), 0, 1/90000: Video: h264, yuv420p, 1280x544 [SAR 1:1 DAR 40:17], 104271/2500000, q=2-31, 23.98 fps, 90k tbn, 23.98 tbc (default)
    Stream #0:1(eng), 0, 1/90000: Audio: dts, 48000 Hz, 5.1(side), 1536 kb/s (default)
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame=  360 fps=0.0 q=-1.0 size=    7616kB time=00:00:14.93 bitrate=4178.5kbits/s    
frame=  382 fps=365 q=-1.0 size=    8368kB time=00:00:15.84 bitrate=4325.2kbits/s    
frame=  402 fps=252 q=-1.0 size=    9042kB time=00:00:16.68 bitrate=4439.6kbits/s    
frame=  416 fps=199 q=-1.0 size=    9581kB time=00:00:17.26 bitrate=4545.3kbits/s    
frame=  433 fps=167 q=-1.0 size=   10327kB time=00:00:17.97 bitrate=4706.0kbits/s    
frame=  445 fps=142 q=-1.0 size=   10907kB time=00:00:18.47 bitrate=4835.9kbits/s    
frame=  458 fps=124 q=-1.0 size=   11533kB time=00:00:19.01 bitrate=4967.5kbits/s    
frame=  471 fps=112 q=-1.0 size=   12155kB time=00:00:19.56 bitrate=5090.3kbits/s    
frame=  485 fps=103 q=-1.0 size=   12824kB time=00:00:20.14 bitrate=5215.0kbits/s    
frame=  500 fps= 95 q=-1.0 size=   13557kB time=00:00:20.77 bitrate=5347.0kbits/s    
frame=  514 fps= 89 q=-1.0 size=   14204kB time=00:00:21.35 bitrate=5449.0kbits/s    
frame=  522 fps= 83 q=-1.0 size=   14584kB time=00:00:21.68 bitrate=5508.5kbits/s    
frame=  534 fps= 79 q=-1.0 size=   15136kB time=00:00:22.18 bitrate=5588.3kbits/s    
frame=  546 fps= 75 q=-1.0 size=   15673kB time=00:00:22.68 bitrate=5658.8kbits/s    
frame=  558 fps= 72 q=-1.0 size=   16348kB time=00:00:23.18 bitrate=5774.9kbits/s    
frame=  567 fps= 62 q=-1.0 size=   16929kB time=00:00:23.56 bitrate=5884.9kbits/s    
frame=  595 fps= 62 q=-1.0 size=   17552kB time=00:00:24.73 bitrate=5813.7kbits/s    
frame=  628 fps= 62 q=-1.0 size=   18327kB time=00:00:26.10 bitrate=5750.0kbits/s    
frame=  661 fps= 62 q=-1.0 size=   19018kB time=00:00:27.48 bitrate=5668.2kbits/s    
frame=  687 fps= 62 q=-1.0 size=   19864kB time=00:00:28.57 bitrate=5695.7kbits/s    
frame=  700 fps= 60 q=-1.0 size=   20577kB time=00:00:29.11 bitrate=5790.0kbits/s    
frame=  712 fps= 58 q=-1.0 size=   21280kB time=00:00:29.61 bitrate=5886.9kbits/s    
frame=  723 fps= 57 q=-1.0 size=   21881kB time=00:00:30.07 bitrate=5960.8kbits/s    
frame=  737 fps= 55 q=-1.0 size=   22570kB time=00:00:30.65 bitrate=6031.3kbits/s    
frame=  754 fps= 54 q=-1.0 size=   23388kB time=00:00:31.36 bitrate=6108.6kbits/s    
frame=  768 fps= 53 q=-1.0 size=   23930kB time=00:00:31.94 bitrate=6135.9kbits/s    
frame=  785 fps= 52 q=-1.0 size=   24485kB time=00:00:32.65 bitrate=6142.0kbits/s    
frame=  799 fps= 51 q=-1.0 size=   24880kB time=00:00:33.24 bitrate=6131.5kbits/s    
frame=  822 fps= 51 q=-1.0 size=   25648kB time=00:00:34.20 bitrate=6143.3kbits/s    
frame=  846 fps= 50 q=-1.0 size=   26279kB time=00:00:35.20 bitrate=6115.5kbits/s    
frame=  865 fps= 50 q=-1.0 size=   26893kB time=00:00:35.99 bitrate=6120.6kbits/s    
frame=  882 fps= 49 q=-1.0 size=   27844kB time=00:00:36.70 bitrate=6214.5kbits/s    
frame=  892 fps= 48 q=-1.0 size=   28501kB time=00:00:37.12 bitrate=6289.8kbits/s    
frame=  904 fps= 47 q=-1.0 size=   29088kB time=00:00:37.62 bitrate=6333.9kbits/s    
frame=  914 fps= 47 q=-1.0 size=   29641kB time=00:00:38.03 bitrate=6383.7kbits/s    
frame=  929 fps= 46 q=-1.0 size=   30335kB time=00:00:38.66 bitrate=6427.4kbits/s    
frame=  933 fps= 46 q=-1.0 Lsize=   30551kB time=00:00:38.83 bitrate=6445.2kbits/s    

video:19774kB audio:7164kB global headers:0kB muxing overhead 13.411975%
Received signal 2: terminating.
Last edited 2 years ago by patters (previous) (diff)

comment:4 Changed 2 years ago by cehoyos

The only needed output is the one from the command line you posted above.

Please test current git head and please explain if and why -async 1 -copyts are necessary (I don't know).

comment:5 Changed 2 years ago by patters

Previous comment updated...

comment:6 Changed 2 years ago by cehoyos

  • Status changed from new to open

Samples uploaded to samples/ffmpeg-bugs/trac/ticket1398.

comment:7 Changed 18 months ago by richardpl

  • Component changed from undetermined to avformat

comment:8 follow-up: Changed 17 months ago by xnejp03

Anyone working on this? It'd be great to have DTS muxing to mpegts.

comment:9 in reply to: ↑ 8 Changed 17 months ago by cehoyos

  • Keywords dca added; DTS removed

Replying to xnejp03:

Anyone working on this? It'd be great to have DTS muxing to mpegts.

Do you know what the problem with the current code is?

comment:10 Changed 17 months ago by patters

It would appear that there are some small compliance issues with FFmpeg's dca avformat specs. Would it be possible to ask one of the dca contributors analyse individual frames and metadata of those two sample files I uploaded (one compliant from tsMuxeR, the other non-compliant from FFmpeg) to spot what's different about them?

comment:11 Changed 17 months ago by patters

I can confirm that the issue persists in FFmpeg 1.1.1

comment:12 follow-up: Changed 11 months ago by iuqbgq9h-1@yahoo.com

I verify this problem on version N-55721-gc443689. When multiplexing an MPEG2-PS format with a DTS audio stream, it sets the stream id for the DTS audio stream to 0x8a. The correct stream id is 0x88. The audio does not play on a hardware player because of this. When I multiplex with a different program that sets the stream id to 0x88, it plays fine on same hardware player. I tried setting the stream id with option '-streamid', but it doesn't change anything (seems it only applies to MPEG2-TS).

Changed 11 months ago by cehoyos

comment:13 in reply to: ↑ 12 ; follow-up: Changed 11 months ago by cehoyos

  • Cc iuqbgq9h-1@yahoo.com added

Replying to iuqbgq9h-1@…:

I verify this problem on version N-55721-gc443689. When multiplexing an MPEG2-PS format with a DTS audio stream, it sets the stream id for the DTS audio stream to 0x8a.

This ticket is about transport streams, if you have a problem with muxing DTS audio into program streams, please open a new ticket (and consider testing if attached patch fixes any issue for you).

comment:14 in reply to: ↑ 13 ; follow-up: Changed 11 months ago by iuqbgq9h-1@yahoo.com

This ticket is about transport streams, if you have a problem with muxing DTS audio into program streams, please open a new ticket (and consider testing if attached patch fixes any issue for you).

I tested the patch - built ffmpeg with it - and it solves the problem. The stream id of 0x8a is the only reason the hardware player wasn't playing the audio. I tried to find some official reference for the right number but couldn't. Two other multiplexers used for DVD authoring I used set the stream number to 0x88, and I found some forum discussions saying it's 0x88 as well. Do you still want me to open a new ticket about this?

Changed 11 months ago by heleppkes

To the original issue, attached patch can be tried, it solved a similar issue for me at some point. The problem was not the DTS itself, but the ADTS muxing in MPEG-TS.

comment:15 Changed 11 months ago by cehoyos

@Hendrik: Please consider elaborating how the patch you attached is related to this ticket=-)
If the patch fixes an actual issue (albeit completely unrelated to the "DTS" meant here), please either send or commit it.

comment:16 follow-up: Changed 11 months ago by heleppkes

My bad, i shouldn't post patches while being 90% asleep. You are right, its unrelated to this ticket.

comment:17 in reply to: ↑ 16 Changed 11 months ago by cehoyos

Replying to heleppkes:

My bad, i shouldn't post patches while being 90% asleep. You are right, its unrelated to this ticket.

np, but perhaps you can comment on the (also unrelated but less unrelated) patch I just sent to the mailing list?

comment:18 in reply to: ↑ 14 ; follow-up: Changed 11 months ago by cehoyos

Replying to iuqbgq9h-1@…:

This ticket is about transport streams, if you have a problem with muxing DTS audio into program streams, please open a new ticket (and consider testing if attached patch fixes any issue for you).

I tested the patch - built ffmpeg with it - and it solves the problem. The stream id of 0x8a is the only reason the hardware player wasn't playing the audio.

Which hardware player did you test?

comment:19 in reply to: ↑ 18 ; follow-up: Changed 11 months ago by iuqbgq9h-1@yahoo.com

Which hardware player did you test?

I'ts made by some anonymous Chinese manufacturer that's imported and relabeled by a local retailer :-). Could very well be that other players would handle the stream id 0x8a. The other multiplexers I tried were dvd-lab and mplex from mjpegtools - and they both set a stream id of 0x88.

To the best of my understanding - AC-3 streams are numbered 0x80 - 0x87, and DTS 0x88-0x8f, so 0x8a would be the third DTS stream - and since there are no streams in the data numbered 0x88 or 0x89 - it may screw up some overly restrictive playback hardware.

The issue is compounded by the '-streamid' option not doing anything for program streams - so it's not possible to manually override the 0x8a value short of a recompile.

comment:20 in reply to: ↑ 19 Changed 11 months ago by cehoyos

Replying to iuqbgq9h-1@…:

Which hardware player did you test?

I'ts made by some anonymous Chinese manufacturer that's imported and relabeled by a local retailer :-).

I'd just like to have a type to put into the commit message.

comment:21 follow-up: Changed 9 months ago by patters

Out of curiosity I made a similar edit to FFmpeg 2.1's libavformat/mpegts.h (changed the DTS stream ID from 0x8a to 0x88). I compiled it and I can report that it did not fix the bug that I originally raised this ticket for.

comment:22 in reply to: ↑ 21 ; follow-up: Changed 3 months ago by goodthanks

Replying to patters:

Out of curiosity I made a similar edit to FFmpeg 2.1's libavformat/mpegts.h (changed the DTS stream ID from 0x8a to 0x88). I compiled it and I can report that it did not fix the bug that I originally raised this ticket for.

I have been looking at this the last couple of days. Using MediaInfo? the issue appears to be the Codec ID (stream type) assigned to the audio stream on the output file.

When muxing with ffmpeg it gives the DTS audio stream a codec ID of 6 (0x06). Tsmuxer gives the DTS audio stream a codec ID of 130 (0x82)
Checking Elementary Stream Types on this page
http://en.wikipedia.org/wiki/Program-specific_information
0x06 - ITU-T Rec. H.222 and ISO/IEC 13818-1 (MPEG-2 packetized data)privately defined (ie, DVB subtitles/VBI and AC-3)

0x82 - DTS 6 channel audio for Blu-ray in a packetized stream

0x06 Doesn't play the audio on my sony player.
0x82 plays fine.

edit: Ok pretty sure I have found the problem.
In libavformat\mpegtsenc.c

Line 288 is the start of a switch function. Inside that function there is no case for DTS so it gets defaulted to Stream_Type_Private_Data. Based on line 50 in libavformat\mpegts.h Stream_Type_Private_Data results in 0x06 being the stream ID used in the output file.

The following needs to inserted into that switch function

case AV_CODEC_ID_DTS:
stream_type = STREAM_TYPE_AUDIO_DTS;
break;

This will result in the output file having a stream ID of 0x8a which should work. If not line 61 of libavformat\mpegts.h probably needs to be changed to
#define STREAM_TYPE_AUDIO_DTS 0x82
from
#define STREAM_TYPE_AUDIO_DTS 0x8a

Got no idea how to compile ffmpeg on windows so hopefully someone else can confirm.

Last edited 3 months ago by goodthanks (previous) (diff)

comment:23 in reply to: ↑ 22 ; follow-ups: Changed 3 months ago by cehoyos

  • Cc goodthanks added

Replying to goodthanks:

Got no idea how to compile ffmpeg on windows so hopefully someone else can confirm.

Could you elaborate?
We invest a lot of time to ensure out-of-the-box compilation on Windows works fine, if it fails for you, please report it!

I will attach a PoC: If somebody can confirm that it fixes this issue, I will try to provide a more complete patch.

Changed 3 months ago by cehoyos

comment:24 in reply to: ↑ 23 ; follow-up: Changed 3 months ago by goodthanks

Replying to cehoyos:

Could you elaborate?
We invest a lot of time to ensure out-of-the-box compilation on Windows works fine, if it fails for you, please report it!

I tried the instructions here
http://pcloadletter.co.uk/2011/05/07/compiling-64bit-ffmpeg-for-windows-with-libfaac/
and get a compile error at the last stage.
The last line in the config.log file is -
./configure: line 771: x86_64-w64-mingw32-gcc: command not found

I'm not a developer and have limited knowledge of linux so it's taking me a while to get my head around it.
Now I have a msys console installed I might give zeranoe's instructions a whirl.

comment:25 in reply to: ↑ 23 ; follow-up: Changed 3 months ago by goodthanks

Replying to cehoyos:

I will attach a PoC: If somebody can confirm that it fixes this issue, I will try to provide a more complete patch.

I can confirm this fixed the issue in that it puts the correct codec ID (stream type) into the output file. 138 (0x8a)
But this file will not play on my hardware.
0x8a is the code for DTS-audio specified here -
http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/M2TS.html
but 0x8a is specified as privately defined here -
http://en.wikipedia.org/wiki/Program-specific_information

Changing the stream_type ID's in libavformat\mpegts.h would fix the issue
eg)
change
#define STREAM_TYPE_AUDIO_DTS 0x8a
to
#define STREAM_TYPE_AUDIO_DTS 0x82

Only problem is im not sure if that is a workaround that will cause issues elsewhere given that first link I provided says 0x8a is correct...

All I know is 0x82 will work on my sony bluray player. And 0x82 is the code tsmuxer uses when remuxing TS files.

comment:26 in reply to: ↑ 25 ; follow-up: Changed 3 months ago by cehoyos

Replying to goodthanks:

Changing the stream_type ID's in libavformat\mpegts.h would fix the issue
eg)
change
#define STREAM_TYPE_AUDIO_DTS 0x8a
to
#define STREAM_TYPE_AUDIO_DTS 0x82

Sorry if I misunderstand: Did you test this locally with your hardware and it fixes the problem or do you think that this change would fix the problem?

comment:27 in reply to: ↑ 24 ; follow-up: Changed 3 months ago by cehoyos

Replying to goodthanks:

Replying to cehoyos:

Could you elaborate?
We invest a lot of time to ensure out-of-the-box compilation on Windows works fine, if it fails for you, please report it!

I tried the instructions here
http://pcloadletter.co.uk/2011/05/07/compiling-64bit-ffmpeg-for-windows-with-libfaac/
and get a compile error at the last stage.
The last line in the config.log file is -
./configure: line 771: x86_64-w64-mingw32-gcc: command not found

I'm not a developer and have limited knowledge of linux so it's taking me a while to get my head around it.
Now I have a msys console installed I might give zeranoe's instructions a whirl.

What's wrong with ./configure && make?

comment:28 in reply to: ↑ 26 ; follow-up: Changed 3 months ago by goodthanks

Replying to cehoyos:

Replying to goodthanks:

Changing the stream_type ID's in libavformat\mpegts.h would fix the issue
eg)
change
#define STREAM_TYPE_AUDIO_DTS 0x8a
to
#define STREAM_TYPE_AUDIO_DTS 0x82

Sorry if I misunderstand: Did you test this locally with your hardware and it fixes the problem or do you think that this change would fix the problem?

I tested on my own hardware and it fixed the problem.

Also this change will make ffmpeg consistent with tsmuxer
http://www.videohelp.com/tools/tsMuxeR

Which already assigns 0x82 to DTS streams in TS files. I know that isn't proof it's correct but it's a good indicator.

comment:29 in reply to: ↑ 27 Changed 3 months ago by goodthanks

Replying to cehoyos:

What's wrong with ./configure && make?

Yeah I figured it out. I was just making it more complicated than it needed to be.

Thanks.

comment:30 in reply to: ↑ 28 ; follow-up: Changed 3 months ago by cehoyos

Replying to goodthanks:

I tested on my own hardware and it fixed the problem.

Could you send a patch - made with git format-patch to the ffmpeg-devel mailing list?

comment:31 in reply to: ↑ 30 ; follow-up: Changed 3 months ago by goodthanks

Replying to cehoyos:

Could you send a patch - made with git format-patch to the ffmpeg-devel mailing list?

As I said I am not a developer. The suggestions I have made are just guesses based on my "very" limited experience with general coding.
I googled "git format-patch" and ended up here -
https://www.ffmpeg.org/developer.html#Submitting-patches

I'm sure everything on that page makes sense to you guys but after melting my brain getting mingw working, I'm having trouble making sure my beam can actually reaches my mouth.

I will check it out tomorrow when I'm sober but no guarantees.

comment:32 in reply to: ↑ 31 ; follow-up: Changed 3 months ago by cehoyos

Replying to goodthanks:

Replying to cehoyos:

Could you send a patch - made with git format-patch to the ffmpeg-devel mailing list?

As I said I am not a developer. The suggestions I have made are just guesses based on my "very" limited experience with general coding.

Do you have git installed?
If yes, update your checkout with git pull make the necessary changes to libavformat/mpegts.h and libavformat/mpegtsenc.c, then commit them with git commit libavformat and produce a patch file with git format-patch HEAD^ which you can send to the mailing list.
If you don't have git installed, just say so.

comment:33 in reply to: ↑ 32 ; follow-up: Changed 3 months ago by goodthanks

Replying to cehoyos:

Do you have git installed?
If yes, update your checkout with git pull make the necessary changes to libavformat/mpegts.h and libavformat/mpegtsenc.c, then commit them with git commit libavformat and produce a patch file with git format-patch HEAD^ which you can send to the mailing list.

Ok I have done all that but im stuck at git send-email. I have everything set correctly but it errors with
Need MIME::Base64 and Authen::SASL
cpan Authen::SASL - worked
cpan MIME::Base64 - failed so I did cpan MIME::Base64::Perl which worked.

Didn't make any difference, I still get the following error - Need MIME::Base64 and Authen::SASL

Keep in mind 2 days ago I had never heard of Git or Mingw so I've probably set something up wrong.

Can I just send the patch file using my mail client (Thunderbird) instead of git or does git send-email do some necessary change to the patch file before sending?

Edit : Ok I got it to work by copying files from msys\1.0\lib\perl5 to mingw\opt\lib\perl5

So I think it's all done. The patch description I used was "Allow DTS audio copy to TS streams"

Just for reference it's a similar issue to the ticket you are looking at here
https://trac.videolan.org/vlc/ticket/10244

Hopefully that helps confirm that 0x82 is the correct stream ID to use.

I just want to say, It's been emotional.

Last edited 3 months ago by goodthanks (previous) (diff)

comment:34 in reply to: ↑ 33 ; follow-up: Changed 3 months ago by cehoyos

Replying to goodthanks:

Replying to cehoyos:

update your checkout with git pull make the necessary changes to libavformat/mpegts.h and libavformat/mpegtsenc.c, then commit them with git commit libavformat and produce a patch file with git format-patch HEAD^ which you can send to the mailing list.

Ok I have done all that but im stuck at git send-email.

This is why I did not suggest to use it (I have never used it so far).

I forgot one thing: If you have not committed yet locally (with git commit libavformat, please add "Fixes ticket #1398." after an empty line to the commit message, if you have already committed, use git commit --amend to be able to edit the message and add the line.
Then run git format-patch HEAD^ to create a patch-file (the name starts with "0001") and send this file with your favorite email program to the ffmpeg-devel mailing list.

comment:35 in reply to: ↑ 34 ; follow-up: Changed 3 months ago by goodthanks

Replying to cehoyos:

I forgot one thing: If you have not committed yet locally (with git commit libavformat, please add "Fixes ticket #1398."

I did think of that later on but I got git send-email working and have already sent it now so I'm assuming it's too late? I got an email back saying it is currently waiting for a moderator to review it.

Sorry if I have caused issues, I'm sure the documentation is easy to handle for people with experience but it was a hefty process for me.

comment:36 in reply to: ↑ 35 Changed 3 months ago by Timothy_Gu

Replying to goodthanks:

Sorry if I have caused issues, I'm sure the documentation is easy to handle for people with experience but it was a hefty process for me.

You should read Git how-to.

So, if you start over, the process should look like this:

  1. git clone <repo>
  2. Edit file.
  3. git commit -a -s
  4. Type:
    mpegts: fix stream type ID for DTS and add TrueHD
    
    Fixes ticket #1398.
    
  5. Exit editor. (IIRC on Msysgit it is vim, so type :q and enter.)
  6. git format-patch HEAD^
  7. git send-email *.patch

It's nice you got git send-email working, because I never did and that's why I use Linux now :)

comment:37 Changed 3 months ago by patters

I have compiled version 2.2.1 with goodthanks' modifications and I can confirm that the original issue I raised the ticket for is resolved. My Sony Bluray player will now play remuxed DTS in mpeg-ts. Photo here:
http://dl.dropboxusercontent.com/u/1188556/WP_20140426_21_27_35_Pro.jpg
I have created a patch file also if someone else wants to try it:
http://dl.dropboxusercontent.com/u/1188556/ffmpeg-ticket1398.patch

comment:38 Changed 3 months ago by cehoyos

  • Resolution set to fixed
  • Status changed from open to closed

Should be fixed in c9cfd458
Thank you for the report, the patch and the testing!

Note: See TracTickets for help on using tickets.