View Single Post
Old 13th November 2018, 00:44   #1  |  Link
FLX90
Registered User
 
Join Date: Nov 2018
Posts: 34
Convert DTS to Dolby and any Lossless to Apple Lossless [BluRay]

Hello everybody,

I have a large BluRay collection and want it to get into my iTunes library to play on AppleTV.
I have no idea of transcoding and stuff like that, but I read many threads here and on other forums and acquire some knowledge.

First. Your program, madshi, is very great. Thank you for this awesome tool!





I need to convert the DTS-audio-streams to Dolby. And I used eac3to for that.


The Audio-Streams of the BluRay are the following and I need them to put into the mentioned codec:

- DTS --> Dolby Digital (AC-3)
- DTS-HD High Resolution --> Dolby Digital Plus (E-AC-3)
- DTS-HD Master --> Apple Lossless (ALAC)
- Dolby TrueHD --> Apple Lossless (ALAC)



Here are the code snippets and their logs I used for some example BluRay-Rips.



Code-Snippet for DTS-HD Master & Dolby Digital --> Apple Lossless & Dolby Digital:

Code:
mkvmerge -i german_dd_to_ac3__english_dtshdma_to_alac.mkv
mkvextract tracks german_dd_to_ac3__english_dtshdma_to_alac.mkv 0:video.h264 1:audio1.ac3 2:audio2.dtshdma 3:sub1.srt
ffmpeg -i  german_dd_to_ac3__english_dtshdma_to_alac.mkv -f ffmetadata chapters
eac3to audio2.dtshdma audio2.flac
eac3to audio2.dtshdma audio2_core.ac3
ffmpeg -i audio2.flac -acodec alac audio2.m4a
ffmpeg^
 -i video.h264 -i audio1.ac3 -i audio2.m4a -i audio2_core.ac3 -i sub1.srt -i chapters^
 -map 0:0 -map 1:0 -map 2:0 -map 3:0 -map 4:0^
 -metadata:s:a:0 language=ger -metadata:s:a:0 handler="Dolby Digital" -metadata:s:a:1 language=eng -metadata:s:a:1 handler="Apple Lossless" -metadata:s:a:2 language=eng -metadata:s:a:2 handler="Dolby Digital" -metadata:s:s:0 language=ger -metadata:s:s:0 handler="Deutsch"^
 -disposition:a:0 default -disposition:a:1 0 -disposition:a:2 0^
 -movflags disable_chpl^
 -c:s mov_text -c:v copy -c:a copy^
 german_dd_to_ac3__english_dtshdma_to_alac.m4v 2>> ffmpeg.log
ffmpeg1.log



Code-Snippet for DTS-HD Master & DTS --> Apple Lossless & Dolby Digital:

Code:
mkvmerge -i german_dts_to_ac3__english_dtshdma_to_alac.mkv
mkvextract tracks german_dts_to_ac3__english_dtshdma_to_alac.mkv 0:video.h264 1:audio1.dts 2:audio2.dtshdma 3:sub1.srt
ffmpeg -i  german_dts_to_ac3__english_dtshdma_to_alac.mkv -f ffmetadata chapters
eac3to audio1.dts audio1.ac3
eac3to audio2.dtshdma audio2.flac
eac3to audio2.dtshdma audio2_core.ac3
ffmpeg -i audio2.flac -acodec alac audio2.m4a
ffmpeg^
 -i video.h264 -i audio1.ac3 -i audio2.m4a -i audio2_core.ac3 -i sub1.srt -i chapters^
 -map 0:0 -map 1:0 -map 2:0 -map 3:0 -map 4:0^
 -metadata:s:a:0 language=ger -metadata:s:a:0 handler="Dolby Digital" -metadata:s:a:1 language=eng -metadata:s:a:1 handler="Apple Lossless" -metadata:s:a:2 language=eng -metadata:s:a:2 handler="Dolby Digital" -metadata:s:s:0 language=ger -metadata:s:s:0 handler="Deutsch"^
 -disposition:a:0 default -disposition:a:1 0 -disposition:a:2 0^
 -movflags disable_chpl^
 -c:s mov_text -c:v copy -c:a copy^
 german_dts_to_ac3__english_dtshdma_to_alac.m4v 2>> ffmpeg.log
ffmpeg2.log



Code-Snippet for Dolby TrueHD & Dolby Digital --> Apple Lossless & Dolby Digital:

Code:
mkvmerge -i german_dd_to_ac3__english_truehd_to_alac.mkv
mkvextract tracks german_dd_to_ac3__english_truehd_to_alac.mkv 0:video.h264 1:audio1.ac3 2:audio2.truehd 3:audio2_core.ac3 4:sub1.srt
ffmpeg -i  german_dd_to_ac3__english_truehd_to_alac.mkv -f ffmetadata chapters
eac3to audio2.truehd audio2.flac
ffmpeg -i audio2.flac -acodec alac -af "aformat=channel_layouts=7.1(wide)" audio2.m4a
ffmpeg^
 -i video.h264 -i audio1.ac3 -i audio2.m4a -i audio2_core.ac3 -i sub1.srt -i chapters^
 -map 0:0 -map 1:0 -map 2:0 -map 3:0 -map 4:0^
 -metadata:s:a:0 language=ger -metadata:s:a:0 handler="Dolby Digital" -metadata:s:a:1 language=eng -metadata:s:a:1 handler="Apple Lossless" -metadata:s:a:2 language=eng -metadata:s:a:2 handler="Dolby Digital" -metadata:s:s:0 language=ger -metadata:s:s:0 handler="Deutsch"^
 -disposition:a:0 default -disposition:a:1 0 -disposition:a:2 0^
 -movflags disable_chpl^
 -c:s mov_text -c:v copy -c:a copy^
 german_dd_to_ac3__english_truehd_to_alac.m4v 2>> ffmpeg.log
ffmpeg3.log



Code-Snippet for DTS-HD Master & Dolby Digital Plus --> Apple Lossless & Dolby Digital Plus:

Code:
mkvmerge -i german_dd+_to_eac3__english_dtshdma_to_alac.mkv
mkvextract tracks german_dd+_to_eac3__english_dtshdma_to_alac.mkv 0:video.h264 1:audio1.eac3 2:audio2.dtshdma 3:sub1.srt 4:sub2.srt
ffmpeg -i  german_dd+_to_eac3__english_dtshdma_to_alac.mkv -f ffmetadata chapters
eac3to audio2.dtshdma audio2.flac
eac3to audio2.dtshdma audio2_core.ac3
ffmpeg -i audio2.flac -acodec alac -af "aformat=channel_layouts=7.1(wide)" audio2.m4a
ffmpeg^
 -i video.h264 -i audio1.eac3 -i audio2.m4a -i audio2_core.ac3 -i sub1.srt -i sub2.srt -i chapters^
 -map 0:0 -map 1:0 -map 2:0 -map 3:0 -map 4:0 -map 5:0^
 -metadata:s:a:0 language=ger -metadata:s:a:0 handler="Dolby Digital Plus" -metadata:s:a:1 language=eng -metadata:s:a:1 handler="Apple Lossless" -metadata:s:a:2 language=eng -metadata:s:a:2 handler="Dolby Digital" -metadata:s:s:0 language=ger -metadata:s:s:0 handler="Deutsch" -metadata:s:s:1 language=eng -metadata:s:s:1 handler="Englisch"^
 -disposition:a:0 default -disposition:a:1 0 -disposition:a:2 0 -disposition:s:0 default^
 -movflags disable_chpl^
 -c:s mov_text -c:v copy -c:a copy^
 german_dd+_to_eac3__english_dtshdma_to_alac.m4v 2>> ffmpeg.log
ffmpeg4.log

ffmpeg5.log (also tried with mp4-container)



Code-Snippet for DTS-HD Master & DTS-HD High Resolution --> Apple Lossless & Dolby Digital Plus:

Code:
mkvmerge -i german_dtshr_to_eac3__english_dtshdma_to_alac.mkv
mkvextract tracks german_dtshr_to_eac3__english_dtshdma_to_alac.mkv 0:video.h264 1:audio1.dtshr 2:audio2.dtshdma
ffmpeg -i  german_dtshr_to_eac3__english_dtshdma_to_alac.mkv -f ffmetadata chapters
eac3to audio1.dtshr audio1.eac3
eac3to audio2.dtshdma audio2.flac
eac3to audio2.dtshdma audio2_core.ac3
ffmpeg -i audio2.flac -acodec alac -af "aformat=channel_layouts=7.1(wide)" audio2.m4a
ffmpeg^
 -i video.h264 -i audio1.eac3 -i audio2.m4a -i audio2_core.ac3 -i chapters^
 -map 0:0 -map 1:0 -map 2:0 -map 3:0^
 -metadata:s:a:0 language=ger -metadata:s:a:0 handler="Dolby Digital Plus" -metadata:s:a:1 language=eng -metadata:s:a:1 handler="Apple Lossless" -metadata:s:a:2 language=eng -metadata:s:a:2 handler="Dolby Digital"^
 -disposition:a:0 default -disposition:a:1 0 -disposition:a:2 0^
 -movflags disable_chpl^
 -c:v copy -c:a copy^
 german_dtshr_to_eac3__english_dtshdma_to_alac.m4v 2>> ffmpeg.log


First of all.
The procedure is always the same (make mkv from BD --> extract mkv --> convert audiostreams --> put them into m4v container).
Is this a proper way to do that?



The first three are working very well and the last two have problems with E-AC-3.

So here are the questions I have:


1. My chapters from the mkv I extract with ffmpeg (ffmpeg -i input.mkv -f ffmetadata chapters) are in text-format. How can I convert them to tx3g (or extract tx3g from mkv).
2. I can set a subtitle to default (-disposition:s:0 default), I need it to be default and forced. Trying it the same way (-disposition:s:0 forced) did not work. How can I do that?
3. When I have to transcode an audio stream with eac3to (so except lossless -> lossless convert), there is always a difference of 0.03 sec to source audio stream (transcode: 01:40:05.79; source: 01:40:05.76). How can I avoid this?
4. I have some warnings about timestamps and durations in my log:
[ac3 @ 00000000005989c0] Estimating duration from bitrate, this may be inaccurate
[ipod @ 0000000002ca4940] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
[ipod @ 0000000002ca4940] pts has no value
Will they disappear when I put timestamps into pts-format in the container?
I can extract them from mkv (mkvextract timecodes_v2 input.mkv 0:video.timecodes.txt 1:audio1.timecodes.txt 2:audio2.timecodes.txt 3:sub1.timecodes.txt 4:sub2.timecodes.txt 5:sub3.timecodes.txt 6:sub4.timecodes.txt) but only in timecodes_v2-format. So how can I convert timecodes_v2 in pts and put them into the container?
4. How to find out the frame size and tell it to ffmpeg (because of this warning: [ipod @ 0000000002ca4940] track 1: codec frame size is not set)?
5. What does this warning message mean: [h264 @ 0000000000444240] Stream #0: not enough frames to estimate rate; consider increasing probesize. And how to avoid it?
6. I will buy the necessary software to get the best results from eac3to (Nero, ArcSoft, Sonic, SurCode, ...). In theoretic, will I get better quality results when I use DTS:X Content Creator Suite and Dolby Media Producer Suite?
7. The conversion of DTS-HD Master and Dolby TrueHD to Apple Lossless takes very long time and CPU usage compared to FLAC to ALAC. Why, when it should be only a lossless to lossess "copy"?


Now the conversions I could not handle.

DTS-HD Master & Dolby Digital Plus --> Apple Lossless & Dolby Digital Plus:
I could not put the E-AC-3 stream into the m4v-Container ([ipod @ 000000000328e140] Could not find tag for codec eac3 in stream #1, codec not currently supported in container; Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument). So I tried the mp4-container.
The conversion is almost finished, than ffmpeg crashes with the following error message: Assertion s->buf_ptr < s->buf_end failed at src/libavcodec/put_bits.h:108.
How can I put E-AC-3 into the m4v-Container?


DTS-HD Master & DTS-HD High Resolution --> Apple Lossless & Dolby Digital Plus:

Eac3to was not able to convert DTS-HD High Resolution to Dolby Digital Plus (eac3to audio1.dtshr audio1.eac3 --> This audio conversion is not supported.). How can I handle this?





It would be really nice if you can help me with my questions.


Thank you very much!


Best regards,
Felix
Attached Files
File Type: txt ffmpeg1.log.txt (57.2 KB, 29 views)
File Type: txt ffmpeg2.log.txt (59.8 KB, 22 views)
File Type: txt ffmpeg3.log.txt (68.8 KB, 16 views)
File Type: txt ffmpeg4.log.txt (5.1 KB, 13 views)
File Type: txt ffmpeg5.log.txt (73.5 KB, 13 views)

Last edited by FLX90; 13th November 2018 at 07:18.
FLX90 is offline   Reply With Quote