Opened 11 years ago

Closed 11 years ago

Last modified 5 years ago

#2099 closed enhancement (needs_more_info)

FFMPEG Does not allow TrueHD, DTS-Master Audio or DTS in .M4V even though format supports it

Reported by: John Galt Owned by:
Priority: wish Component: avformat
Version: git-master Keywords: mov dca thd
Cc: Ron Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
How to reproduce:

% ffmpeg -i "source.mkv" -map 0:0 -map 0:1 -map 0:1 -c:v copy -c:a:0 copy -c:a:1 ac3 -ac 6 -ab 448k "destination.m4v"
N-48284-g518239c
Dec 29 2012 22:41:41

Source file is H264 + DTS-Master Audio Track.

Attempting to output h264 + DTS Master Audio + ac3 fall back track.

Standard says that DTS Master, DTS, and TrueHD are supported by M4V, however FFMPEG throws:

track 1: could not find tag, codec not currently supported in container

Attachments (1)

patchthdmov.diff (583 bytes ) - added by Carl Eugen Hoyos 11 years ago.

Download all attachments as: .zip

Change History (56)

in reply to:  description ; comment:1 by Carl Eugen Hoyos, 11 years ago

Component: FFmpegavformat
Keywords: mov dca thd added; TrueHD m4v DTS Master Audio DTS removed
Priority: normalwish
Type: defectenhancement

Replying to JohnGalt:

Standard says that DTS Master, DTS, and TrueHD are supported by M4V, however FFMPEG throws:

Please provide samples.

Generally, please always provide a failing command line together with complete, uncut console output on this bug tracker to make tickets valid.

comment:2 by John Galt, 11 years ago

Sorry, here's the output for the above command:

ffmpeg version N-48284-g518239c Copyright (c) 2000-2012 the FFmpeg developers

built on Dec 29 2012 22:41:41 with gcc 4.7.2 (GCC)
configuration: --disable-static --enable-shared --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --ena

ble-frei0r --enable-gnutls --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libopencore-amr
nb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libtheora --enable-libtwolame --enable-li
bvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib

libavutil 52. 12.100 / 52. 12.100
libavcodec 54. 81.100 / 54. 81.100
libavformat 54. 50.104 / 54. 50.104
libavdevice 54. 3.102 / 54. 3.102
libavfilter 3. 30.101 / 3. 30.101
libswscale 2. 1.103 / 2. 1.103
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 2.100 / 52. 2.100

Input #0, matroska,webm, from 'source.mkv':

Metadata:

creation_time : 2012-12-07 22:11:56

Duration: 01:41:23.38, start: 0.000000, bitrate: 33582 kb/s

Chapter #0.0: start 0.000000, end 186.250000
Metadata:

title : 00:00:00.000

Chapter #0.1: start 186.250000, end 512.708000
Metadata:

title : 00:03:06.250

Chapter #0.2: start 512.708000, end 883.292000
Metadata:

title : 00:08:32.708

Chapter #0.3: start 883.292000, end 1354.000000
Metadata:

title : 00:14:43.292

Chapter #0.4: start 1354.000000, end 1865.458000
Metadata:

title : 00:22:34.000

Chapter #0.5: start 1865.458000, end 2122.500000
Metadata:

title : 00:31:05.458

Chapter #0.6: start 2122.500000, end 2386.125000
Metadata:

title : 00:35:22.500

Chapter #0.7: start 2386.125000, end 2801.167000
Metadata:

title : 00:39:46.125

Chapter #0.8: start 2801.167000, end 2923.000000
Metadata:

title : 00:46:41.167

Chapter #0.9: start 2923.000000, end 3388.500000
Metadata:

title : 00:48:43.000

Chapter #0.10: start 3388.500000, end 3808.167000
Metadata:

title : 00:56:28.500

Chapter #0.11: start 3808.167000, end 4071.375000
Metadata:

title : 01:03:28.167

Chapter #0.12: start 4071.375000, end 4378.750000
Metadata:

title : 01:07:51.375

Chapter #0.13: start 4378.750000, end 4681.583000
Metadata:

title : 01:12:58.750

Chapter #0.14: start 4681.583000, end 4989.792000
Metadata:

title : 01:18:01.583

Chapter #0.15: start 4989.792000, end 5311.667000
Metadata:

title : 01:23:09.792

Chapter #0.16: start 5311.667000, end 5629.083000
Metadata:

title : 01:28:31.667

Chapter #0.17: start 5629.083000, end 6083.382000
Metadata:

title : 01:33:49.083

Stream #0:0(eng): Video: h264 (High), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 24 fps, 24 tbr, 1k tbn, 48 tbc (default)
Stream #0:1(eng): Audio: dts (DTS-HD MA), 48000 Hz, 5.1(side), fltp, 1536 kb/s (default)

track 1: could not find tag, codec not currently supported in container
Output #0, ipod, to 'destination.m4v':

Metadata:

encoder : Lavf54.50.104
Chapter #0.0: start 0.000000, end 186.250000
Metadata:

title : 00:00:00.000

Chapter #0.1: start 186.250000, end 512.708000
Metadata:

title : 00:03:06.250

Chapter #0.2: start 512.708000, end 883.292000
Metadata:

title : 00:08:32.708

Chapter #0.3: start 883.292000, end 1354.000000
Metadata:

title : 00:14:43.292

Chapter #0.4: start 1354.000000, end 1865.458000
Metadata:

title : 00:22:34.000

Chapter #0.5: start 1865.458000, end 2122.500000
Metadata:

title : 00:31:05.458

Chapter #0.6: start 2122.500000, end 2386.125000
Metadata:

title : 00:35:22.500

Chapter #0.7: start 2386.125000, end 2801.167000
Metadata:

title : 00:39:46.125

Chapter #0.8: start 2801.167000, end 2923.000000
Metadata:

title : 00:46:41.167

Chapter #0.9: start 2923.000000, end 3388.500000
Metadata:

title : 00:48:43.000

Chapter #0.10: start 3388.500000, end 3808.167000
Metadata:

title : 00:56:28.500

Chapter #0.11: start 3808.167000, end 4071.375000
Metadata:

title : 01:03:28.167

Chapter #0.12: start 4071.375000, end 4378.750000
Metadata:

title : 01:07:51.375

Chapter #0.13: start 4378.750000, end 4681.583000
Metadata:

title : 01:12:58.750

Chapter #0.14: start 4681.583000, end 4989.792000
Metadata:

title : 01:18:01.583

Chapter #0.15: start 4989.792000, end 5311.667000
Metadata:

title : 01:23:09.792

Chapter #0.16: start 5311.667000, end 5629.083000
Metadata:

title : 01:28:31.667

Chapter #0.17: start 5629.083000, end 6083.382000
Metadata:

title : 01:33:49.083

Stream #0:0(eng): Video: h264 (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 24 fps, 16k tbn, 1k tbc (default)
Stream #0:1(eng): Audio: dts, 48000 Hz, 5.1(side), 1536 kb/s (default)
Stream #0:2(eng): Audio: ac3 (ac-3 / 0x332D6361), 48000 Hz, 5.1, fltp, 448 kb/s (default)

Stream mapping:

Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Stream #0:1 -> #0:2 (dca -> ac3)

Could not write header for output file #0 (incorrect codec parameters ?): Operation not permitted

in reply to:  1 comment:3 by Carl Eugen Hoyos, 11 years ago

Replying to cehoyos:

Replying to JohnGalt:

Standard says that DTS Master, DTS, and TrueHD are supported by M4V, however FFMPEG throws:

Please provide samples.

Sorry for being unclear:
What is needed to test this new feature are samples of DTS-HD Master and TrueHD in m4v that can be decded / played with some application.

comment:4 by John Galt, 11 years ago

Sorry, don't have and can't find a track with these in it. However here's the spec doc that says that m4v supports them:

http://www.mp4ra.org/codecs.html

(It's probably because ffmpeg doesn't support this that I can't find any files with it in it!). Note that mp4 does not support it, only m4v.

comment:5 by Elon Musk, 11 years ago

FFmpeg indeed does not suppot DTS, TrueHD in m4a/m4v (ipod muxer).

The link you provided does not claim that m4a/m4v support them either.

in reply to:  4 comment:6 by Carl Eugen Hoyos, 11 years ago

Replying to JohnGalt:

Sorry, don't have and can't find a track with these in it.

I really wonder if this ticket makes any sense without samples.
(Note that it is possible and even likely that no samples exist because no application supports it. In that case it is probably much better that FFmpeg does not write such files.)

However here's the spec doc that says that m4v supports them:

http://www.mp4ra.org/codecs.html

Where does it say that TrueHD is supported?

comment:7 by John Galt, 11 years ago

All codecs listed on that page are supported right now with m4v.

Dolby is in the process of getting TrueHD certified. DTS Master and DTS are already certified as is clearly outlined when you click on the details for each.

I think that there is HUGE value in FFMPEG supporting this given that m4v/mp4 is the format that is supported by essentially all players/set-top boxes. (mkv is not supported by Roku, ios or Windows 8 and is randomly supported on android) Thus being able to write these tracks into the files is required before anyone will enable bitstreaming these tracks out of the files.

Given how many products use ffmpeg for encoding files, until you guys support this, we won't get files that work, and thus we won't get players that will stream the audio tracks out of the files properly.

Thus it's chicken or the egg, and you're the chicken that has to lay the egg first.

Correct me if I'm wrong, but it should just be a matter of writting the standard version of these tracks out to the file just like ac3 or aac is written now. (i.e. a copy of the track should "just work")

comment:8 by Hendrik, 11 years ago

The mp4ra link lists "Dolby MLP" as a possible format, which essentially is just TrueHD.

"Dolby MLP - MLP (Dolby TrueHD) streams within the ISO Base Media File Format, version 1.0, September 2009"

comment:9 by Elon Musk, 11 years ago

I see no where that m4v or m4a is explicitely mentioned.

comment:10 by Elon Musk, 11 years ago

You can already write such files if you force muxer with -f mp4

comment:11 by John Galt, 11 years ago

Thanks! It appears to work (still working on the file but it didn't freak out) with the -f mp4 on it....

However it's my understanding that *.m4v was the only extension that officially supports multiple audio tracks etc. so I would have assumed that it would have figured this out with m4v as the file extension and done this without the flag.

comment:12 by Elon Musk, 11 years ago

What is wrong with mp4 extension?

comment:13 by John Galt, 11 years ago

I believe that mp4 doesn't support multiple audio streams or sub titles properly on most apple devices. It needs to be .m4v to work properly.

comment:14 by John Galt, 11 years ago

FYI, I tried using -f ipod to force the moov atom to the front of the file but it also fails with the same error. It needs to be able to handle multiple audio tracks as well.

comment:15 by Elon Musk, 11 years ago

And you are sure that most apple devices supports DTS/TrueHD?

Last edited 11 years ago by Elon Musk (previous) (diff)

comment:16 by John Galt, 11 years ago

They don't support it at all. But they also won't play an .mp4 file with multiple audio tracks.

The point is that .m4v explicitly allows multiple audio tracks on apple devices. the apple devices will play .m4v files and find the best track available that it can play. (I just tested this with an .m4v that I forced with the -f mp4 that has DTS-Master Audio in it and ac3. It played the ac3 just fine on both an apple tv and an Ipad 2.)

So the point is still the same, -f mp4 should actually fail from what I understand (correct me if I'm wrong) with multiple audio tracks because .mp4 doesn't support multiple audio tracks. It should only work with .m4v and it shouldn't throw the error. Nor should it through the error for -f ipod and with that setting and multiple audio tracks it should require the .m4v file extension. (if you care)

comment:17 by John Galt, 11 years ago

(For both Apple and Windows 8 devices the ac3/aac track must be first I found out)

Also the -f mp4 does not allow trueHD tracks, which it should because it's in the standard as a draft.

In short I believe that:

.m4v should automatically allow TrueHD, DTS Master, and DTS tracks without having to force -f mp4

-f ipod should support TrueHD, DTS Master, and DTS tracks and order the audio tracks automatically so that the tracks are in the right order (thus giving us the ability to the put the moov atom in the right spot)

comment:18 by Carl Eugen Hoyos, 11 years ago

Resolution: needs_more_info
Status: newclosed
Version: unspecifiedgit-master

I will close this as "needs_more_info" because there is neither a sample for TrueHD in isom nor is it clear on the mp4ra page that TrueHD should be supported at all (mlp is not exactly the same thing and I would be mildly surprised if Dolby chose "mlpa" as code and not "thda" or similar).

You repeatedly mention "m4v": In FFmpeg nomenclature, "m4v" means mov-for-iPod or at least iDevice. These devices currently do neither support TrueHD nor DTS (and not DTS-HD) and there is currently to the best of my knowledge no indication whatsoever that this will change in the future. So I think this ticket should be about mov or isom in general but not "m4v" (using the FFmpeg meaning).
Muxing DTS in mov works fine (although it may never have been tested with any proprietary software that is supposed to support mov and DTS), if you want to mux DTS-HD use -atag dtsh, for DTS-HD Master (lossless) use -atag dtsl.

If you can show that muxing DTS in mov is broken in the sense that it cannot be played with software that is supposed to play it (I would not be surprised at all), please open a new ticket with more information / a sample that allows playback.

If you can provide a TrueHD in mov sample, please reopen this ticket.

by Carl Eugen Hoyos, 11 years ago

Attachment: patchthdmov.diff added

comment:19 by Carl Eugen Hoyos, 11 years ago

I missed the line "MLP (Dolby TrueHD) streams" on the mp4ra site;-)
A patch is attached, it should be tested as soon as either a sample appears or an application that allows testing is known.

comment:20 by John Galt, 11 years ago

Great on the patch!

My point is that -f m4v, -f mp4 and -f ipod should all allow TrueHD, DTS Master, and DTS audio streams to be included and not error out like it does now.

i.e. -f mp4 won't allow DTS even though it's clearly supported by the standard and -f ipod is just moov atom optimized and should allow the same options as -f mp4 as should -f m4v

It appears that the artificial blocks in the code that are stopping these from being included need to be removed as if you dance around them you can get it to encode them in mp4 files and they work fine, but it should just do it without having to jump through hoops.

comment:21 by Elon Musk, 11 years ago

The patch that makes ipod muxer to mux anything is one liner. It is left as exercise to the reader.

comment:22 by John Galt, 11 years ago

Is the patch going to be pushed into the code base? Or is this going to be separate?

comment:23 by Carl Eugen Hoyos, 11 years ago

Which patch?

comment:24 by John Galt, 11 years ago

The patchhdmov.diff above and the one referenced by richardpl...

I don't want to have to go through all of the source code and fix it by hand and then get it to compile if I can avoid it...

comment:25 by Elon Musk, 11 years ago

No patch will get applied without real proof.

comment:26 by John Galt, 11 years ago

Proof of what?

you have the link to the standards doc that DTS and DTS Master are fully supported, and Dolby TrueHD is supported with MLP and on the horizon for full support.

At the very least mp4, m4v and ipod formats should support DTS and DTS Master Audio. TrueHD should also be allowed per the confirmation from others above.

Yes you don't have a file. But guess what? You guys are the guys that make the files!

comment:27 by Carl Eugen Hoyos, 11 years ago

As written above, I will suggest the patch for inclusion as soon as either a file appears that needs the patch to be decoded (not made with FFmpeg) or an application is named that supports decoding such files.

comment:28 by Carl Eugen Hoyos, 11 years ago

What are you going to do with the files that you plan to produce?

comment:29 by compn, 11 years ago

all we want is a file, that plays in an ipod, with the specified codec.
if you can make some samples that play in quicktime or the ipod with those codecs, we will add it to ffmpeg.

we dont want ffmpeg to create non-standard files that only playback with ffmpeg.

if we add a patch without using the proper hex code or isom tag, then it wont work in official hardware/software either. so we'd like to see a working sample , so we can copy our implementation based on it.

if you just want to copy your truehd mkv rips to mp4 format to play on playstation3 or ipod, there are programs out there to automatically transcode and stream files. http://en.wikipedia.org/wiki/PS3_Media_Server

comment:30 by John Galt, 11 years ago

And as I've said the Ipod will not play anything more than 5.1 sound (outputed via cables). That isn't the point. The VAST majority of players, be it Windows 8, Apple TV, Roku et. al. do not support MKV.

The ONLY format that is supported by all of them is M4V/MP4. Thus the point is, that software like plex etc. can easily bitstream the 7.1 audio tracks properly when used with them, AND the same file will work with the other various players.

Thus it is HIGHLY desirable to be able to include TrueHD, DTS Master Audio, DTS, AC3 5.1, AC3 2.0, AAC 5.1, AAC 2.0, MP3 2.0 etc. all in the m4v container. WHICH IS SUPPORTED BY THE FORMAT.

Thus you don't have to use MKV that doesn't work in so many cases. It also works VERY well for web streaming whereas MKV is DOA unless you're in Firefox. (webm)

The only other format that even comes close is m2ts and a huge number of players won't play it even though they easily could.

Hence if you want a format that works on all players (i.e. I have Windows 8, Plex, Ipad, Iphone, roku and Google TV devices) so you don't have to constantly be transcoding with plex (i.e. direct play/stream to all devices) and can be downloaded onto the devices without a lengthy transcode process as well, the format of choice is m4v NOT MKV.

Thus it is entirely rational to want to store the 7.1 tracks and generate a ac3 compatibility track for fall back as well, which is what I'm trying to accomplish.

(and no, Transcoding constantly is not a reasonable solution... look at your power useage the next time you transcode. Transcode once, and then direct play every time is a MUCH better solution because you take the power hit ONCE and only ONCE not every time you decid to watch the movie again!)

in reply to:  29 comment:31 by Carl Eugen Hoyos, 11 years ago

Replying to compn:

if you can make some samples that play in quicktime or the ipod with those codecs, we will add it to ffmpeg.

I don't think this is necessary. If TrueHD in mp4 or DTS in mp4 play in any application or any device we will support it.

if you just want to copy your truehd mkv rips to mp4 format to play on playstation3

Does the playstation3 support TrueHD in mp4?

in reply to:  30 comment:32 by Carl Eugen Hoyos, 11 years ago

Replying to JohnGalt:

The ONLY format that is supported by all of them is M4V/MP4. Thus the point is, that software like plex etc. can easily bitstream the 7.1 audio tracks properly when used with them, AND the same file will work with the other various players.

That sounds promising: Please explain which exact software will support decoding (or bitstreaming) TrueHD in mp4 or DTS-HD in mp4 and I will try to support muxing such files with FFmpeg.
Or provide a short sample that worked for you.

Hence if you want a format that works on all players (i.e. I have Windows 8, Plex, Ipad, Iphone, roku and Google TV devices) so you don't have to constantly be transcoding with plex (i.e. direct play/stream to all devices) and can be downloaded onto the devices without a lengthy transcode process as well, the format of choice is m4v NOT MKV.

Who suggested mkv?

Thus it is entirely rational to want to store the 7.1 tracks and generate a ac3 compatibility track for fall back as well, which is what I'm trying to accomplish.

I completely agree! If DTS-HD or TrueHD are supported by any software or device, we should really try hard to support it!

in reply to:  30 comment:33 by Carl Eugen Hoyos, 11 years ago

Replying to JohnGalt:

Thus it is HIGHLY desirable to be able to include [...] MP3 2.0 etc. all in the m4v container.

I missed this sentence, sorry:
Do you have a mp3 in m4v/mp4 sample that plays in QuickTime, Apple TV, Windows 8, Plex, Ipad, Iphone, roku or Google TV?
This feature was often requested by users, sadly so far no sample played on any software or device tested.

comment:34 by compn, 11 years ago

http://samples.mplayerhq.hu/MPEG-4/mp3-in-mp4/ ?

oh m4v no clue.

do the force-muxed truehd files play in quicktime at all?
is there a dts-ma codec for quicktime available for purchase?

comment:35 by John Galt, 11 years ago

I don't have quicktime to test if they play. I don't really care if they do. They do play on my ipad as long as there is an ac3 or aac track before the DTS Master Audio Track. (which I have tested)

Windows 8 has a bug that I've reported that causes it to choose the bitstream audio track always even if the computer won't support it) instead of the proper audio track, no matter which order you encode the tracks in.

My google TV will direct play the file created and play the ac3 5.1 track only if it's first even if the device isn't hooked up to a bitstream receiver (hdmi). It will bitstream the DTS Master track properly in every case when plugged into HDMI.

in reply to:  35 comment:36 by Carl Eugen Hoyos, 11 years ago

Replying to JohnGalt:

My google TV will direct play the file created and play the ac3 5.1 track only if it's first even if the device isn't hooked up to a bitstream receiver (hdmi). It will bitstream the DTS Master track properly in every case when plugged into HDMI.

Please provide the sample.

in reply to:  34 comment:37 by Carl Eugen Hoyos, 11 years ago

Replying to compn:

http://samples.mplayerhq.hu/MPEG-4/mp3-in-mp4/ ?

MP3 in mp4 works fine with FFmpeg (both demuxing and muxing), sorry for the noise!

comment:38 by John Galt, 11 years ago

Just FYI, I've built a Windows Service that will monitor directories where files get downloaded into, automatically convert them based on your settings, include any high res tracks that you want to keep, and convert down to whatever lower resolution track(s) you want.

So for instance if it takes an mkv or an m2ts file in that has TrueHD and AC-3 5.1 and you say you want to keep truehd and ac351 it will copy both audio tracks. If the source only had TrueHD and you want ac351 too it would copy the truehd track and create the ac351 track automatically.

In every case if the video is h264 it just copies it. If it's AVI it will transcode to h264.

Interface is as simple as telling it what audio tracks you want and it will create whatever the source file will allow to be created from it, and jam it in. Same with subtitles, it will automatically insert all of the sub titles in, that are for whatever languages you check off.

And it automatically goes out and gets the meta data for the source file and includes that in the destination file if supported (mkv and mp4 support putting the meta data in the file) and I'm working on having it generate an .nfo file automatically.

Once complete it will automatically delete the original and delete the parent folder if it's named the same as the source (both optionally).

I'm also working on having it automatically name the destination file based on rules and create a sub folder under the destination folder for it as well.

The idea is, get whatever you want from wherever you want, and this will convert it into a universal format with everything you want in it, give you all of the meta data and organize it all for you all automatically in the background based on the rules that you setup.

Hence why I'm attempting to make this work, because the premise of having a single conversion happen once and then everything is automatically included and it will play anywhere without real-time transcoding is the point to the exercise.

I'd rather not have to have people choose between 7.1 sound with mkv and only 5.1 sound and mp4 for obvious reasons.

And I'd like to be able to use the ipod preset so that the moov atom gets put in the right place so that I don't have to run mp4box/qt-faststart after the file is generated to fix it.

So if anyone can help get this going, I'm going to release this as an open source product once I'm happy with it. (I'm also planning on putting in bit torrent with full RSS feed support including magnets with a much better UI for it than utorrent/bittorrent has in their client, but that's another story.)

For a sample file go here: http://www.demo-world.eu/trailers/high-definition-trailers.php

Grab all parts for the DTS Master Audio sample, and use FFMPEG with -f mp4 and copy the audio and video tracks. It will work fine.

comment:39 by Elon Musk, 11 years ago

You can use -movflags faststart, no need for extra tool

comment:40 by compn, 11 years ago

imo -movflags faststart should be default.

in reply to:  38 comment:41 by Carl Eugen Hoyos, 11 years ago

Replying to JohnGalt:

In every case if the video is h264 it just copies it. If it's AVI it will transcode to h264.

It transcodes AVI to h264? That's impressive!

I'd rather not have to have people choose between 7.1 sound with mkv and only 5.1 sound and mp4 for obvious reasons.

Yes, I agree!
Just provide the DTS-HD Master in mp4 sample you tested with GoogleTV and I will try to fix this!

Last edited 11 years ago by Carl Eugen Hoyos (previous) (diff)

comment:42 by John Galt, 11 years ago

-movflags faststart = awesome! Thanks!

I'm also allowing people to choose mkv and m2ts as output formats. Mkv works fine but there's a bug in m2ts output that I'm going to report in a separate report.

The mp4 sample that I tested was a full movie at 4 gb in size. Hence my instructions.

comment:43 by John Galt, 11 years ago

I found a way to get an m4v file that has AAC, AC-3 and DTS-MA or TrueHD in it!

You can use Handbreak to do this. On the audio tab, tell it to transcode to AAC, and/or AC-3 and then add another track of the original DTS-MA or TrueHD and tell it to do a paththrough.

This will successfully generate the m4v file with all 3 tracks and I've been able to confirm that it works fine by playing back the DTS-MA track in VLC with bitstreamed 7.1 audio that my receiver correctly identified as DTS-MA.

Incidently, unlike the same file created in ffmpeg, Windows 8's Video app played the AAC track correctly.

It would be HUGE to have FFPMEG do this. Then there would be no need for m2ts!

in reply to:  43 comment:44 by Carl Eugen Hoyos, 11 years ago

Replying to JohnGalt:

I found a way to get an m4v file that has AAC, AC-3 and DTS-MA or TrueHD in it!

Please provide a sample and please explain how the TrueHD track in the file can be played back.
Ideally, you would explain how TrueHD can be played back with a Dolby-certified playback software.

comment:45 by John Galt, 11 years ago

Take the sample from above that is an m2ts file. Load it into handbreak, and under audio, tell it to create an audio track with True HD passthrough. Set it to mp4 and large and web optimized. (it will create an m4v). Feel free to create a secondary ac3 downmix track as well so that there are 2 audio tracks in the file.

Let it encode.

Open up VLC and play the file. The audio tracks will both be listed. If you have a compatible audio receiver hooked up via HDMI or Displayport it will bitstream the truehd track directly to the receiver without issue and the receiver will decode it. On anything else, the secondary ac3 track will work just fine.

Again, TrueHD is not certified on any software to be decoded. NONE. TrueHD can be bitstreamed to Digital receivers via HDMI or DisplayPort only, and the receiver that your computer his hooked into will decode it. (even Blueray software cannot decode TrueHD or DTS-MA, they can only bitstream the tracks to a receiver that can)

This works exactly the same way as MKV, and since there is no Dolby certified playback software for MKVs and yet you support MKVs with TrueHD audio tracks that bitstream, there should be no reason why you don't with mp4s. (Same goes for DTS-HD since both are supported by the standard)

in reply to:  45 comment:46 by Carl Eugen Hoyos, 11 years ago

Replying to JohnGalt:

Again, TrueHD is not certified on any software to be decoded. NONE.

This sounds very unlikely.

TrueHD can be bitstreamed to Digital receivers via HDMI or DisplayPort only, and the receiver that your computer his hooked into will decode it.

(even Blueray software cannot decode TrueHD or DTS-MA, they can only bitstream the tracks to a receiver that can)

This sounds plain wrong to me.

But it doesn't matter: It is sufficient if you upload a sample because FFmpeg tries to decode all samples, valid or not.

comment:47 by John Galt, 11 years ago

Again: Use the sample linked to above, use handbreak as instructed and create the file. Then you'll also see what they're doing so that you can do it exactly the same.

TrueHD and DTS-MA must be bitstreamed. They cannot be decoded on PCs (legally) into PCM or any other format. It's the same as SACD required either analog out, or bitstreaming to play 5.1 audio from them back in the day. They don't want their tracks decrypted by anything other than closed boxes. That's why LAV has check boxes for bitstreaming them and NOTHING else will actually decode them to 7.1 sound at full definition and play back over analog speakers hooked into a sound card.

In any event: I've demonstrated that Handbreak will create m4v files with TrueHD and DTS-MA, I've given you instructions on how to do it, and I've instructed you on how you can play them back properly which is everything you asked for.

(you can use Windows Media Center to also play them back bitstream if you install LAV and check off the bitstreaming flags for the formats and hook into HDMI with a receiver that supports it)

in reply to:  47 comment:48 by Carl Eugen Hoyos, 11 years ago

Replying to JohnGalt:

TrueHD and DTS-MA must be bitstreamed. They cannot be decoded on PCs (legally) into PCM or any other format.

Sorry that I started this discussion, it has no relevance for this ticket.

Please reopen the ticket if you can provide a sample that cannot be decoded with current FFmpeg (like TrueHD in mov/isom).

comment:49 by John Galt, 11 years ago

The ticket isn't about not being able to decode the file. The ticket is about not being able to encode the file!

FFMPEG cannot create (from all documentation, and all comments in here and all comments online) an m4v file with TRUEHD OR DTS-MA tracks in it even though the standard allows it, and even though Handbreak can do it and the resulting files play just fine.

Thus FFMPEG needs to fix support for encoding M4V with TRUEHD AND DTS-MA. That's the point.

in reply to:  49 comment:50 by Carl Eugen Hoyos, 11 years ago

Replying to JohnGalt:

The ticket isn't about not being able to decode the file. The ticket is about not being able to encode the file!

I understand that, please read the following:
I originally asked for "proof" that it makes sense to allow muxing TrueHD mov/isom. (I expected that this would not be possible but otoh I couldn't know if you have access to Dolby reference software - that quite certainly allows to test and verify - or not.) You did not present any such hint that it makes sense if FFmpeg allows muxing TrueHD into mov (on the contrary imo). But please read on because from your point of you, this does not matter!

The mov/isom muxer/demuxer is written in a way that makes sure that every format that can be read automatically can also be written (in a possibly wrong way but still).
So if you provide a sample with TrueHD in mov/isom that cannot be read by FFmpeg and it will be fixed, the fix automatically / unintentionally will also bring muxing. (One could argue that we should strongly avoid that because the world already knows enough invalid media files, but this is not relevant for this ticket.)

Thus FFMPEG needs to fix support for encoding M4V with TRUEHD AND DTS-MA. That's the point.

Are you sure that writing DTS-MA in isom does not work? I thought it works fine.

Last edited 11 years ago by Carl Eugen Hoyos (previous) (diff)

comment:51 by John Galt, 11 years ago

See Handbreak example.

DTS-MA fails with error on write.

comment:52 by Elon Musk, 11 years ago

I don't have Handbreak and are not willing to install it.

comment:53 by Ron, 9 years ago

I'm not sure why the original poster had such an issue with posting a sample. The issue still exists. You can find a sample here. This sample will play without issue on an Apple TV.

https://www.dropbox.com/s/twr5r16zia2v8kc/How%20To%20Train%20Your%20Dragon%202%20w%20DTS.m4v?dl=0

As long as the first audio stream is 2 channel AAC, any subsequent tracks can be passed via bitstream to an external tuner. This was tested and works without issue on a Gen 2 and Gen 3 Apple TV.

I was able to work around it by forcing the output format (-f mp4), but I don't think this should be necessary.

in reply to:  53 comment:54 by Carl Eugen Hoyos, 9 years ago

Cc: Ron added

Replying to DJRumpy:

I was able to work around it by forcing the output format (-f mp4), but I don't think this should be necessary.

Using -f mp4 means FFmpeg wrote a mp4 (isom) file not an m4v (ipod) file. Iirc, the original issue here in this ticket was not to support DTS in isom (this works currently if I understand your tests correctly) but to support DTS in ipod / m4v files. We should not create such files unless we know that they are valid / supported.
The sample you provided is also an isom file (not an ipod file).

comment:55 by Carl Eugen Hoyos, 5 years ago

A specification for TrueHD in isom exists now and ticket #8051 was created.

Note: See TracTickets for help on using tickets.