Closed rhapsodians closed 9 years ago
Screenshot may help with the formatting above ...
Joe,
Thanks for so much information in your issue post! Very helpful, indeed. And great choice on the movies. (I have the same set but in Blu-ray.)
OK, now on to solving your problem. This is your command:
transcode-video.sh --crop 0:0:0:0 --audio 2 --add-audio 1 --add-audio 2 --add-all-subtitles 'The Girl with the Dragon Tattoo (2009).mkv'
There's no need to specify a crop of 0:0:0:0
since those are the default values anyway. Not a big deal, but it makes the command shorter.
You're adding the Swedish audio track twice with that --add-audio 2
option. That's why it's showing up as the fourth audio track in your output. Just remove that.
The --audio 2
option is all you need to place the Swedish track first in the output as the main track in both AAC and AC-3 formats. Why? Because the main track, selected with the --audio
option, is transcoded twice by default, just like iTunes.
The real problem here is your --add-audio 1
option to add the English track. It's working as designed but not getting you what you want. Why? By default, the --add-audio
option creates only one track in AAC format in your output. You have to explicitly tell it to transcode the track twice using the double
prefix in front of the track number. That will get you both an AAC and a AC-3 format track in your output.
So, here's what I think you meant to do:
transcode-video.sh --audio 2 --add-audio double,1 --add-all-subtitles 'The Girl with the Dragon Tattoo (2009).mkv'
My apologies for the options and the --help
documentation being confusing. I'm trying to improve that in the rewrite.
Please don't hesitate to file these wonderful issue reports in the future. They are a delight to read and answer. Thanks again!
Thanks Don - works perfectly now. I'd got as far as bash -x debugging the script to see what (and more importantly how) the audio settings were being built up. It would have taken me a while to work out I was including the track twice and to also include the explicit 'double'.
Great scripts and keep up the good work!!
Hi again,
Just did a quick test using the bash scripts with the same original BluRay rip mkv source.
Command run:
transcode-video.sh --crop 140:140:0:0 --big --chapters 4 --audio 2 --add-audio double,1 --add-subtitle 1 --output 'CTHD.Ch4.orig-script.mp4' 'Crouching Tiger Hidden Dragon (2000).mkv'
This time, you caught an error:
transcode-video.sh: incompatible additional subtitle track for MP4 format: 1
which comes from:
if [ "$container_format" != 'mkv' ] && [[ "$subtitle_track_info" =~ '(PGS)' ]]; then
die "incompatible additional subtitle track for MP4 format: $track_number"
fi
When I hash-out this if statement, and then re-run the script, it burns-in again for the .mp4 version:
[17:22:06] job configuration:
[17:22:06] * source
[17:22:06] + Crouching Tiger Hidden Dragon (2000).mkv
[17:22:06] + title 1, chapter(s) 4 to 4
[17:22:06] + container: matroska,webm
[17:22:06] * destination
[17:22:06] + CTHD.Ch4.orig-script.mp4
[17:22:06] + container: MPEG-4 (libavformat)
[17:22:06] * video track
[17:22:06] + decoder: h264
[17:22:06] + filters
[17:22:06] + Framerate Shaper (2:27000000:900000)
[17:22:06] + frame rate: 23.976 fps -> peak rate limited to 30.000 fps
[17:22:06] + Subtitle renderer (140:140:0:0)
[17:22:06] + Crop and Scale (1920:800:140:140:0:0)
[17:22:06] + source: 1920 * 1080, crop (140/140/0/0): 1920 * 800, scale: 1920 * 800
[17:22:06] + strict anamorphic
[17:22:06] + storage dimensions: 1920 * 800, mod 0
[17:22:06] + pixel aspect ratio: 1 / 1
[17:22:06] + display dimensions: 1920 * 800
[17:22:06] + encoder: H.264 (libx264)
[17:22:06] + options: vbv-maxrate=8000:vbv-bufsize=4000:crf-max=25
[17:22:06] + quality: 16.00 (RF)
[17:22:06] * subtitle track 1, English (track 3, id 0x3) Picture [PGS] -> Render/Burn-in
[17:22:06] * audio track 1
[17:22:06] + decoder: Chinese (FLAC) (5.1 ch) (track 2, id 0x2)
[17:22:06] + samplerate: 48000 Hz
[17:22:06] + mixdown: Dolby Pro Logic II
[17:22:06] + encoder: AAC (Apple AudioToolbox)
[17:22:06] + bitrate: 160 kbps, samplerate: 48000 Hz
[17:22:06] * audio track 2
[17:22:06] + decoder: Chinese (FLAC) (5.1 ch) (track 2, id 0x2)
[17:22:06] + samplerate: 48000 Hz
[17:22:06] + mixdown: 5.1 Channels
[17:22:06] + encoder: AC3 (libavcodec)
[17:22:06] + bitrate: 640 kbps, samplerate: 48000 Hz
[17:22:06] * audio track 3
[17:22:06] + decoder: English (FLAC) (5.1 ch) (track 1, id 0x1)
[17:22:06] + samplerate: 48000 Hz
[17:22:06] + mixdown: Dolby Pro Logic II
[17:22:06] + encoder: AAC (Apple AudioToolbox)
[17:22:06] + bitrate: 160 kbps, samplerate: 48000 Hz
[17:22:06] * audio track 4
[17:22:06] + decoder: English (FLAC) (5.1 ch) (track 1, id 0x1)
[17:22:06] + samplerate: 48000 Hz
[17:22:06] + mixdown: 5.1 Channels
[17:22:06] + encoder: AC3 (libavcodec)
[17:22:06] + bitrate: 640 kbps, samplerate: 48000 Hz
[17:22:06] encx264: min-keyint: 24, keyint: 240
[17:22:06] encx264: encoding at constant RF 16.000000
[17:22:06] encx264: unparsed options: vbv-maxrate=8000:vbv-bufsize=4000:crf-max=25
x264 [info]: using SAR=1/1
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX AVX2 FMA3 LZCNT BMI2
x264 [info]: profile High, level 4.0
[17:22:06] reader: first SCR 128806200 id 0x0 DTS 128806200
Back to the .mkv test (with the hashes removed from the script) ... it runs correctly and has a separate (non-burned-in subtitle).
[17:26:12] job configuration:
[17:26:12] * source
[17:26:12] + Crouching Tiger Hidden Dragon (2000).mkv
[17:26:12] + title 1, chapter(s) 4 to 4
[17:26:12] + container: matroska,webm
[17:26:12] * destination
[17:26:12] + CTHD.Ch4.orig-script.mkv
[17:26:12] + container: Matroska (libavformat)
[17:26:12] * video track
[17:26:12] + decoder: h264
[17:26:12] + filters
[17:26:12] + Framerate Shaper (2:27000000:900000)
[17:26:12] + frame rate: 23.976 fps -> peak rate limited to 30.000 fps
[17:26:12] + Crop and Scale (1920:800:140:140:0:0)
[17:26:12] + source: 1920 * 1080, crop (140/140/0/0): 1920 * 800, scale: 1920 * 800
[17:26:12] + strict anamorphic
[17:26:12] + storage dimensions: 1920 * 800, mod 0
[17:26:12] + pixel aspect ratio: 1 / 1
[17:26:12] + display dimensions: 1920 * 800
[17:26:12] + encoder: H.264 (libx264)
[17:26:12] + options: vbv-maxrate=8000:vbv-bufsize=4000:crf-max=25
[17:26:12] + quality: 16.00 (RF)
[17:26:12] * subtitle track 1, English (track 3, id 0x3) Picture [PGS] -> Passthrough
[17:26:12] * audio track 1
[17:26:12] + decoder: Chinese (FLAC) (5.1 ch) (track 2, id 0x2)
[17:26:12] + samplerate: 48000 Hz
[17:26:12] + mixdown: 5.1 Channels
[17:26:12] + encoder: AC3 (libavcodec)
[17:26:12] + bitrate: 640 kbps, samplerate: 48000 Hz
[17:26:12] * audio track 2
[17:26:12] + decoder: Chinese (FLAC) (5.1 ch) (track 2, id 0x2)
[17:26:12] + samplerate: 48000 Hz
[17:26:12] + mixdown: Dolby Pro Logic II
[17:26:12] + encoder: AAC (Apple AudioToolbox)
[17:26:12] + bitrate: 160 kbps, samplerate: 48000 Hz
[17:26:12] * audio track 3
[17:26:12] + decoder: English (FLAC) (5.1 ch) (track 1, id 0x1)
[17:26:12] + samplerate: 48000 Hz
[17:26:12] + mixdown: 5.1 Channels
[17:26:12] + encoder: AC3 (libavcodec)
[17:26:12] + bitrate: 640 kbps, samplerate: 48000 Hz
[17:26:12] * audio track 4
[17:26:12] + decoder: English (FLAC) (5.1 ch) (track 1, id 0x1)
[17:26:12] + samplerate: 48000 Hz
[17:26:12] + mixdown: Dolby Pro Logic II
[17:26:12] + encoder: AAC (Apple AudioToolbox)
[17:26:12] + bitrate: 160 kbps, samplerate: 48000 Hz
[17:26:12] encx264: min-keyint: 24, keyint: 240
[17:26:12] encx264: encoding at constant RF 16.000000
[17:26:12] encx264: unparsed options: vbv-maxrate=8000:vbv-bufsize=4000:crf-max=25
[17:26:12] reader: first SCR 128806200 id 0x0 DTS 128806200
x264 [info]: using SAR=1/1
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX AVX2 FMA3 LZCNT BMI2
x264 [info]: profile High, level 4.0
So I'm going to re-rip the original BluRay just in case it's the source. I'm also repeat this on the DVD version of The Girl with the Dragon Tattoo (Swedish version) to see if I can replicate the behaviour.
Joe,
No need to re-rip the original Blu-ray. I'm pretty sure I know what the problem is for the Ruby-based transcode-video
tool now. It's your --add-subtitle 1
option and argument for MP4 output. You can't add Blu-ray Disc PGS format subtitles to MP4 files. And, probably due to a bug, the tool is failing to prevent you from doing that.
I'm really glad you did this test! :)
aaaah ... that makes sense! Which is probably why HB is burning it in instead of throwing an error too.
But it implies another question: if you take a BluRay source .mkv and decide to output as .mp4, then what are your subtitle options? Forced-subtitles burnt-in (=good) -OR- any other subtitle burnt into the video track (e.g. English on Chinese, or French on English). Correct?
And I guess that's why using Matroska format is more flexible in this case.
So are there any other options like (.srt files) which can be used in MP4 containers? Reason I ask: I've defaulted to outputting .mp4 for two reasons:
Your thoughts would be appreciated ...
Many thanks (again). Joe
Joe,
See my comments in the other issue you reported as well as the "README" file where I give specific recommendations on this.
Hi Don,
This is probably just me and incorrectly using the scripts but I cannot get the Stieg Larsson 2009 trilogy (Swedish movies) to audio transcode correctly. The DVDs are: The Girl with the Dragon Tattoo, The Girl who Played with Fire and The Girl who Kicked the Hornets' Nest.
Step 1 - Use MakeMKV 1.9.2 to output both English & Swedish main audio tracks + English subtitles ... output of the resultant .mkv below from MediaInfo
General Unique ID : 190069108957839133553546758950652104718 (0x8EFDFA958D7188B99C8B651E9686500E) Complete name : /Volumes/4TB Hitachi/Rips/The Girl with the Dragon Tattoo (2009)/The Girl with the Dragon Tattoo (2009).mkv Format : Matroska Format version : Version 2 File size : 5.41 GiB Duration : 2h 26mn Overall bit rate mode : Variable Overall bit rate : 5 288 Kbps Encoded date : UTC 2015-04-28 10:20:21 Writing application : MakeMKV v1.9.2 darwin(x86-release) Writing library : libmakemkv v1.9.2 (1.3.0/1.4.1) darwin(x86-release)
Video ID : 1 Format : MPEG Video Format version : Version 2 Format profile : Main@Main Format settings, BVOP : Yes Format settings, Matrix : Custom Format settings, GOP : Variable Format settings, picture structure : Frame Codec ID : V_MPEG2 Codec ID/Info : MPEG 1 or 2 Video Duration : 2h 26mn Bit rate mode : Variable Bit rate : 4 415 Kbps Maximum bit rate : 7 500 Kbps Width : 720 pixels Height : 576 pixels Display aspect ratio : 16:9 Frame rate mode : Constant Frame rate : 25.000 fps Standard : PAL Color space : YUV Chroma subsampling : 4:2:0 Bit depth : 8 bits Scan type : Interlaced Scan order : Top Field First Compression mode : Lossy Bits/(Pixel*Frame) : 0.426 Time code of first frame : 10:02:03:00 Time code source : Group of pictures header GOP, Open/Closed : Open GOP, Open/Closed of first frame : Closed Stream size : 4.52 GiB (83%) Language : English Default : No Forced : No
Audio #1 ID : 2 Format : AC-3 Format/Info : Audio Coding 3 Mode extension : CM (complete main) Format settings, Endianness : Big Codec ID : A_AC3 Duration : 2h 26mn Bit rate mode : Constant Bit rate : 384 Kbps Channel(s) : 6 channels Channel positions : Front: L C R, Side: L R, LFE Sampling rate : 48.0 KHz Bit depth : 16 bits Compression mode : Lossy Stream size : 402 MiB (7%) Title : Surround 5.1 Language : English Default : Yes Forced : No
Audio #2 ID : 3 Format : AC-3 Format/Info : Audio Coding 3 Mode extension : CM (complete main) Format settings, Endianness : Big Codec ID : A_AC3 Duration : 2h 26mn Bit rate mode : Constant Bit rate : 384 Kbps Channel(s) : 6 channels Channel positions : Front: L C R, Side: L R, LFE Sampling rate : 48.0 KHz Bit depth : 16 bits Compression mode : Lossy Stream size : 402 MiB (7%) Title : Surround 5.1 Language : Swedish Default : No Forced : No
Text ID : 4 Format : VobSub Codec ID : S_VOBSUB Codec ID/Info : Picture based subtitle format used on DVDs Language : English Default : Yes Forced : No
Menu 00:00:00.000 : en:Chapter 01 00:10:46.160 : en:Chapter 02 00:18:35.880 : en:Chapter 03 00:28:37.200 : en:Chapter 04 00:40:30.360 : en:Chapter 05 00:48:21.520 : en:Chapter 06 00:58:19.000 : en:Chapter 07 01:08:39.040 : en:Chapter 08 01:19:09.720 : en:Chapter 09 01:26:21.960 : en:Chapter 10 01:38:53.200 : en:Chapter 11 01:45:12.640 : en:Chapter 12 01:58:14.240 : en:Chapter 13 02:06:34.880 : en:Chapter 14 02:14:24.840 : en:Chapter 15 02:19:36.880 : en:Chapter 16
Step 2 - Transcode with your latest script ... aim is to have two audio tracks in the .mp4 (Swedish and English) + non-burned-in English subtitles. Default playing mode aim: Swedish + English subtitles. Also, I'd like to optionally switch to dubbed English with no subtitles.
transcode-video.sh --crop 0:0:0:0 --audio 2 --add-audio 1 --add-audio 2 --add-all-subtitles 'The Girl with the Dragon Tattoo (2009).mkv'
Step 3 - Output Summary ...
[11:59:15] hb_init: starting libhb thread HandBrake svn7073 (2015040901) - Darwin x86_64 - https://handbrake.fr 8 CPUs detected Opening The Girl with the Dragon Tattoo (2009).mkv... [11:59:15] CPU: Intel(R) Core(TM) i7-4960HQ CPU @ 2.60GHz [11:59:15] - Intel microarchitecture Haswell [11:59:15] - logical processor count: 8 [11:59:15] OpenCL device #1: Intel Iris Pro [11:59:15] - OpenCL version: 1.2 [11:59:15] - driver version: 1.2(Mar 27 2015 01:47:22) [11:59:15] - device type: GPU [11:59:15] - supported: YES [11:59:15] OpenCL device #2: NVIDIA GeForce GT 750M [11:59:15] - OpenCL version: 1.2 [11:59:15] - driver version: 10.2.7 310.41.25f01 [11:59:15] - device type: GPU [11:59:15] - supported: no [11:59:15] hb_scan: path=The Girl with the Dragon Tattoo (2009).mkv, title_index=1 libbluray/bdnav/index_parse.c:162: indx_parse(): error opening The Girl with the Dragon Tattoo (2009).mkv/BDMV/index.bdmv libbluray/bdnav/index_parse.c:162: indx_parse(): error opening The Girl with the Dragon Tattoo (2009).mkv/BDMV/BACKUP/index.bdmv libbluray/bluray.c:2182: nav_get_title_list(The Girl with the Dragon Tattoo (2009).mkv) failed [11:59:15] bd: not a bd - trying as a stream/file instead libdvdnav: Using dvdnav version 5.0.1 libdvdread:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.IFO failed libdvdread:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.BUP failed libdvdread: Can't open file VIDEO_TS.IFO. libdvdnav: vm: failed to read VIDEO_TS.IFO [11:59:15] dvd: not a dvd - trying as a stream/file instead Input #0, matroska,webm, from 'The Girl with the Dragon Tattoo (2009).mkv': Duration: 02:26:29.20, start: 0.000000, bitrate: N/A Chapter #0.0: start 0.000000, end 646.160000 Metadata: title : Chapter 01 Chapter #0.1: start 646.160000, end 1115.880000 Metadata: title : Chapter 02 Chapter #0.2: start 1115.880000, end 1717.200000 Metadata: title : Chapter 03 Chapter #0.3: start 1717.200000, end 2430.360000 Metadata: title : Chapter 04 Chapter #0.4: start 2430.360000, end 2901.520000 Metadata: title : Chapter 05 Chapter #0.5: start 2901.520000, end 3499.000000 Metadata: title : Chapter 06 Chapter #0.6: start 3499.000000, end 4119.040000 Metadata: title : Chapter 07 Chapter #0.7: start 4119.040000, end 4749.720000 Metadata: title : Chapter 08 Chapter #0.8: start 4749.720000, end 5181.960000 Metadata: title : Chapter 09 Chapter #0.9: start 5181.960000, end 5933.200000 Metadata: title : Chapter 10 Chapter #0.10: start 5933.200000, end 6312.640000 Metadata: title : Chapter 11 Chapter #0.11: start 6312.640000, end 7094.240000 Metadata: title : Chapter 12 Chapter #0.12: start 7094.240000, end 7594.880000 Metadata: title : Chapter 13 Chapter #0.13: start 7594.880000, end 8064.840000 Metadata: title : Chapter 14 Chapter #0.14: start 8064.840000, end 8376.880000 Metadata: title : Chapter 15 Chapter #0.15: start 8376.880000, end 8789.200000 Metadata: title : Chapter 16 Stream #0.0(eng): Video: mpeg2video (Main), yuv420p, 720x576 [PAR 64:45 DAR 16:9], 7500 kb/s, 25 fps, 1k tbn, 50 tbc Stream #0.1(eng): Audio: ac3, 48000 Hz, 5.1, fltp, 384 kb/s (default) Metadata: title : Surround 5.1 Stream #0.2(swe): Audio: ac3, 48000 Hz, 5.1, fltp, 384 kb/s Metadata: title : Surround 5.1 Stream #0.3(eng): Subtitle: dvdsub (default) [11:59:15] scan: decoding previews for title 1 [11:59:15] scan: audio 0x1: ac3, rate=48000Hz, bitrate=384000 English (AC3) (5.1 ch) [11:59:15] scan: audio 0x2: ac3, rate=48000Hz, bitrate=384000 Svenska (AC3) (5.1 ch) [11:59:16] scan: 10 previews, 720x576, 25.000 fps, autocrop = 70/70/0/0, aspect 16:9, PAR 64:45 [11:59:16] libhb: scan thread found 1 valid title(s)
Encoding: task 1 of 1, 0.08 % Encoding: task 1 of 1, 0.17 % Encoding: task 1 of 1, 0.28 % Encoding: task 1 of 1, 0.38 % Encoding: task 1 of 1, 0.49 % Encoding: task 1 of 1, 0.53 % Encoding: task 1 of 1, 0.55 % Encoding: task 1 of 1, 0.57 % Encoding: task 1 of 1, 0.59 % Encoding: task 1 of 1, 0.60 % Encoding: task 1 of 1, 0.62 % Encoding: task 1 of 1, 0.64 % Encoding: task 1 of 1, 0.65 % Encoding: task 1 of 1, 0.67 % (239.61 fps, avg 352.37 fps, ETA 00h10m19s) Encoding: task 1 of 1, 0.69 % (239.61 fps, avg 352.37 fps, ETA 00h10m19s)
NOTE - there are four audio tracks (as expected). This is what I expected to find: Audio Track 1: Swedish 5.1 -> Swedish Stereo Audio Track 2: Swedish 5.1 -> Swedish transcoded AC3 5.1 Audio Track 3: English 5.1 -> English Stereo Audio Track 4: English 5.1 -> English transcoded AC3 5.1
However, Track 4 in the transcoded mp4 is a repeat of track 1 (Swedish 5.1 -> Swedish Stereo) instead of the English 5.1 track.
Am I doing something wrong or is there a bug lingering somewhere? (I'll have a look at the handbrake command separately in addition to the script to see if I can find it).
Thanks, Joe