View Full Version : tsMuxer Open Source
von Suppé
28th February 2022, 10:13
Thanks for clarifying, a5180007.
videoh
4th March 2022, 00:13
Hey guys, want to play around with my new utility (thdmerge) that combines a THD stream (without embedded AC3) and an AC3 stream? These two are obtained from demuxing a bluray THD stream (splitting THD and the embedded AC3) using DGDemux or DGIndexNV. This is required if you want to get a combined THD stream with seamless branching gaps correction on both the THD and AC3 streams. The resulting combined stream can then be muxed using tsmuxer. It may be useful elsewhere, for example, to convert MKVs carrying separated streams back to merged bluray format. Let me know what other related utilities I can make to help you out with THD.
http://rationalqm.us/board/viewtopic.php?f=16&p=15406#p15406
Feel free to use this wherever you want without restriction. If no issues come to light I'll publish the source code. Honestly, it wasn't very hard to make this.
Hat tip von Suppé for pushing me to find a way to make a combined THD with gaps correction.
xledentaldj
6th March 2022, 00:57
videoh, this needs a MacOS (Arm) binary/build and a GUI. Gettin tired of the command line tools I have (ffmpeg, USeac3toGUI, dovi_tool, mp4muxer_mac, tsmuxer). Im the Mac mini M1 (Arm) person who helped with the tsmuxer compiling errors with justdan96 and xavery. Thanks.
Kuler087
6th March 2022, 18:20
http://rationalqm.us/board/viewtopic.php?f=16&p=15406#p15406
OMG thank you so much. this is much faster than eac3to to convert THD MKV to THD+ac3 TS since it doesnt have to re-encode a core. This will save me a lot of time.
videoh
7th March 2022, 01:41
Glad you find it useful and thank you for your testing. I will release it formally with source code tomorrow. There will be an option to choose what to do if the two audio streams are not the same duration: truncate the longer one or do not truncate it.
videoh
7th March 2022, 01:44
videoh, this needs a MacOS (Arm) binary/build and a GUI. Gettin tired of the command line tools I have (ffmpeg, USeac3toGUI, dovi_tool, mp4muxer_mac, tsmuxer). Im the Mac mini M1 (Arm) person who helped with the tsmuxer compiling errors with justdan96 and xavery. Thanks. Can't test MAC/ARM so you'll have to compile your own. If you want a GUI you'll have to do that yourself as well. Should be easy for you.
The code will be integrated into DGDemux and DGIndexNV so it will be transparent there, i.e., no need to invoke it manually.
Kuler087
7th March 2022, 20:32
just to let you know that I made a 64kbps silent ac3 core and used your tool to merge it with trueHD and it works fine on my Sony x800m2. :D
I hope it will be implemented in tsmuxer soon
videoh
8th March 2022, 16:58
Great, thank you for the update.
Version 1.1 is now released with source code. See the file thdmerge.zip contained in the DGDemux distribution:
http://rationalqm.us/dgdemux/binaries/DGDemux_1.0.0.59.zip
Right click and 'Save link as...'.
von Suppé
9th March 2022, 12:53
@videoh:
In the UsEac3to thread I learned about the -t switch for truncating a longer audiotrack.
Are there more parameters possible in thdmerge command line?
videoh
9th March 2022, 14:12
Only -t is there now. Feel free to ask for anything else you need.
schorman
9th March 2022, 20:53
Thanks so much for thdmerge! I very much appreciate it.
I've done a few attempts to reconstruct a .thd+ac3 from the separate tracks, and it seems that the merged versions don't exactly match the thd+ac3 tracks that I rip directly from disc.
I would assume that reconstructing the .thd+ac3 from individual tracks should produce a file that is identical to one created by demuxing from the disc structure directly with TS muxer.
To be clear, I'm not using tracks that are subject to seamless branching for this comparison.
All the data seems to match, but it seems like the ac3 frames are inserted at different points in the thd track. Is there a reason for this difference? Does it matter?
videoh
9th March 2022, 21:57
I don't think it matters. I try to keep audio sync as close as possible, i.e., the THD and AC3 frames for a given time are always close to each other in the combined stream. The bluray spec does not specify how the streams are to be interleaved. I did look at a couple bluray combined streams and there didn't seem to be much rhyme or reason to it so I didn't try to match things. I suppose if it works we can be happy.
yannick92
19th March 2022, 13:47
Thanks for TrueHD/Atmos detection!
What a pleasure to no longer have an error message when opening a file... ;)
However, would it be possible to have the choice to keep the "pure ThrHD" tracks (without the AC3 core) separately?
Something like this:
18063
THX
videoh
19th March 2022, 14:35
yannick92, can you please upload that image somewhere and give a link? Attachments here can take ages, and people often don't keep checking for approval and soon your post is forgotten, or it gets lost in subsequent posts. Thank you.
yannick92
19th March 2022, 18:35
yannick92, can you please upload that image somewhere and give a link? Attachments here can take ages, and people often don't keep checking for approval and soon your post is forgotten, or it gets lost in subsequent posts. Thank you.
Ok THX>>>>> https://uptobox.com/b7i4sj39rrwb
videoh
19th March 2022, 21:11
Ha ha, now I get:
This page is not allowed in the US
tebasuna51
19th March 2022, 22:16
However, would it be possible to have the choice to keep the "pure ThrHD" tracks (without the AC3 core) separately?
For what soft is your request?
This thread is for tsMuxer.
yannick92
20th March 2022, 02:02
For what soft is your request?
This thread is for tsMuxer.
Yes I know, but maybe I misunderstood myself, I just wanted to know if we could have this type of choice in TsMuxer as in MKVToolnix?
My apologies if the capture was too much...
SeeMoreDigital
20th March 2022, 11:23
Yes I know, but maybe I misunderstood myself, I just wanted to know if we could have this type of choice in TsMuxer as in MKVToolnix?Errr... No!
The Blu-ray disc specification requires a mandatory Dolby Digital core within the TrueHD stream. Which has been the main point of discussion for the last few months!
Indeed, it could be argued that if the Matroska developers had created a way of keeping the Dolby Digital core within the TrueHD stream, we wouldn't have been in this mess in the first place :eek:
tebasuna51
20th March 2022, 11:35
In MKVToolnix it is not a choice because mkv don't support thd+ac3 and automatically split the thd+ac3 in 2 tracks.
In tsMuxer when you mux to m2ts for BD's you need the thd with ac3, a lonely thd is not supported, but you have the option of include (or extract) the ac3 only.
To split thd+ac3 tracks you have mkvextract, eac3to and the DG tools.
[EDIT]SeeMoreDigital is fast than me.
von Suppé
24th March 2022, 12:07
Is it possible to add files with .eac3 and .truehd+ac3 extension to the "All supported media files" ?
It would be nice when they would show by default in tsMuxer's browsing windows.
medikoo
28th March 2022, 20:32
Thanks to tsMuxer I'm capable to mux UHD discs and burn them on BD-R media.
Still, I found that my player (Panasonic DP-UB9000) while supporting UHD written on BD-R DL discs, occasionally stutters when playing them, as if the discs were slow (or the player not reading them at needed speeds).
I wonder whether it can be a media issue (I use Verbatim M-DISC BD-R DL), and can be improved by trying some other BD-R DL disc (?) or is it something related to how this player reads BD-R DL discs, potentially capping them to the certain speed limit, and that's not solvable with given player.
Did anyone try to burn and play UHD on BD-R DL with success? Note I mux discs simply to replace audio files (to get a version in my language for my kids), I do not do any size squashing and I'm not interested in that.
SeeMoreDigital
28th March 2022, 20:38
@medikoo,
Which 'git' version of TSmuxer GUI are you using?
a5180007
3rd April 2022, 21:08
Still, I found that my player (Panasonic DP-UB9000) while supporting UHD written on BD-R DL discs, occasionally stutters when playing them, as if the discs were slow (or the player not reading them at needed speeds).
Test the read speed of your discs. With 128 mbps UHD you need a read speed of 4x throughout the BD-R.
von Suppé
4th April 2022, 14:54
:thanks: for eac3 and thd showing up in the browsing windows
medikoo
4th April 2022, 22:13
Which 'git' version of TSmuxer GUI are you using?
It's git-aed1949 (but I don't think it's related to the problem)
Test the read speed of your discs. With 128 mbps UHD you need a read speed of 4x throughout the BD-R.
I tested and tried two different BD-R DL media, and read goes as 16MB/s at start, but shortly after settles on 20Mb/s+ for rest of a disc. It's what I get with LG Drive on macOS system.
UHD at highest moment may need 144Mbp/s (18MB/s), so that should be fine.
I suspect that Panasonic player reads it unconditionally at x2.
And seeing that maximum standard rotation for BD DL BD-ROM media is x2 (http://www.hughsnews.ca/faqs/authoritative-blu-ray-disc-bd-faq/8-recording-and-reading-speed) I assume that's very likely :/
Pity it doesn't support BD XL at UHD reading speeds, that would solve it.
von Suppé
15th April 2022, 11:13
Is it possible to add files with .eac3 and .truehd+ac3 extension to the "All supported media files" ?
It would be nice when they would show by default in tsMuxer's browsing windows.
I haven't checked since what version, but latest nightly build does show .ac3+thd extension, where .thd+ac3 don't show by default in browser window. Can you fix it please?
Thanks in advance
filler56789
16th April 2022, 08:57
SUGGESTION:
give to the periodical official releases better names than the unimaginative and unhelpful
mac.zip lnx.zip w32.zip w64.zip.
After many years of the infamous vcredist_x86.exe and vcredist_x64.exe I thought that everybody would have already learned the lesson.
Sadly I was wrong. :)
gonca
19th April 2022, 23:57
For LPCM tracks, would it be possible to demux to W64 to avoid splitting larger tracks?
von Suppé
20th April 2022, 06:56
Nice to see both .thd+ac3 and .ac3+thd files are showing up in the browser windows.
:thanks: for the fix.
varekai
21st April 2022, 12:50
Thanks for the update and the continued impressive work with this one of a kind absolutely necessary tool!:thanks:
d3rd3vil
22nd April 2022, 19:35
Whats the problem when converting a Dolby Vision mkv to m2ts leads to gray bars (instead of black ones)?
SeeMoreDigital
22nd April 2022, 20:23
Whats the problem when converting a Dolby Vision mkv to m2ts leads to gray bars (instead of black ones)?What are your playback display device/eqipment?
d3rd3vil
22nd April 2022, 21:01
Its a 2016 Oled with an Oppo 203. Sometimes it works/worked with black bars but nowadays its usually grey bars :(
Kuler087
22nd April 2022, 23:02
Its a 2016 Oled with an Oppo 203. Sometimes it works/worked with black bars but nowadays its usually grey bars :(
your content is probably cropped and it's not a tsmuxer issue.
The oppo and sony x700/x800m2 will produce grey letterbox if you play a DV video that was encoded without black bars (3840X1600).
d3rd3vil
23rd April 2022, 12:29
Well ok then what a shame. Any way to get the black bars back with tsmuxer or makemkv or sth? Or does it have to be encoded again:mad:
Kuler087
23rd April 2022, 13:37
Or does it have to be encoded again:mad:
yes :(
I use my TV internal PLEX app for cropped DV video.
varekai
24th April 2022, 10:18
Well ok then what a shame. Any way to get the black bars back with tsmuxer or makemkv or sth? Or does it have to be encoded again:mad:
I use PotPlayer (displaying subtitles below cropped areas) when playing cropped mkv's and also on an OPPO95.
But, text subtitles do not, sadly, render well on the OPPO...
Someone (Groucho2004) a very skilled person in this forum, presented this bat file for me some years ago and it works like a charm.
I use this bat script, using ffmpeg, for adding black bars on top and bottom for mkv.
There are several guides how to setup ffmpeg.
To test if you got the ffmpeg setup right open a command prompt and type ffmpeg -version.
Use 2 HDDs, for fastest encoding, one for source and the other for target.
I think (-crf 18) is supposed to be "placebo" but I have used lower values and still not getting monstrously big outputs.
Depending on your setup it can take some time to encode, but it works like a charm!
Copy to notepad, save as .bat in the extension.
*** (script starts here exclude *** and text)
@echo off
set SOURCEPATH=X:\SOURCEPATH
set TARGETPATH=Y:\TARGETPATH
if not exist "%SOURCEPATH%" goto ErrorSource
if not exist "%TARGETPATH%" goto ErrorTarget
for %%i in ("%SOURCEPATH%\*.mkv") do (
start/b/wait/low ffmpeg -i "%%i" -vf "pad=3840:2160:(ow-iw)/2:(oh-ih)/2" -c:v libx264 -preset slow -crf 18 -c:a copy "%TARGETPATH%\%%~ni.mkv"
echo.
)
goto Exit
:ErrorSource
echo Source path "%SOURCEPATH%" does not exist.
goto :eof
:ErrorTarget
echo Target path "%TARGETPATH%" does not exist.
goto :eof
:Exit
echo Done.
echo.
*** (script ends here exclude *** and text)
d3rd3vil
24th April 2022, 13:32
Sounds interesting god bless you.
The mkv keeps the Dolby Vision? And it says nonstop "skipping NAL Unit 62". Apparently thats because ffmpeg doesnt know what to do with the DV-layer. But as long as it doesnt touch it its fine.
Lets see what will happen.
CPU-load 100%, good to grill sausages on the cooler.
varekai
24th April 2022, 13:51
I have absolutely no idea about Dolby Vision and if it's working in ffmpeg, that question may be answered by the skilled persons in the forum, and that's not me...
Yup, have the sausages close when encoding... :D
Edit: I found this and it's waaay over my head but I think ffmpeg can handle Dobly Vision, but don't take my word for it.
https://codecalamity.com/encoding-uhd-4k-hdr10-videos-with-ffmpeg/
I found the old thread where Groucho2004 helped me...
Time flies when having fun! (https://forum.doom9.org/showthread.php?t=174997#:~:text=Posts%3A%20487-,How%20to%20add%20blackbars%20to%20mkv%20files%20on%20bottom%20and%20top%3F,-Hello!%0A%0ADon%27t%20know) :D
d3rd3vil
24th April 2022, 16:22
Well ok so I've tried it. Dolby Vision is gone after the process so that doesnt work. But maybe there is another way to keep everything AND add black bars somehow. I have a feeling there could be a way with ffmpeg?!
mczuzlak
28th April 2022, 14:54
I have some 4k Bluray backups as untouched mkv remuxes (using MakeMKV) that I would like to play on my Oppo 203.
So if I play the mkv directly it works except I get only HDR but no DV. If I mux it into .ts with the latest Tsmuxer the problem is solved I get DV but there is no TrueHD only DD.
Is this the limitation of the .ts container or something related to the oppo ?
Any workaround I could use to get Lossless Audio + DV working from these mkvs remuxed again with Tsmuxer into something on my oppo 203 ?
Thanks !
SeeMoreDigital
28th April 2022, 15:25
If I mux it into .ts with the latest Tsmuxer the problem is solved I get DV but there is no TrueHD only DD.
Is this the limitation of the .ts container or something related to the oppo ?I've created a dozen or so 4K UHD back-ups that include Dolby Vision and TrueHD/Atmos using TSmuxer.
I select TSmuxer's 'Blu-ray Folder' option. And then transfer the 'BDMV and CERTIFICATE' folders within an (manually created) AVCHD folder prior to playback with my OPPO?
mczuzlak
28th April 2022, 15:29
I've created a dozen or so 4K UHD back-ups that include Dolby Vision and TrueHD/Atmos using TSmuxer.
I select TSmuxer's 'Blu-ray Folder' option. And then transfer the 'BDMV and CERTIFICATE' folders within an (manually created) AVCHD folder prior to playback?
Was your source file before using tsmuxer a full Bluray (with BDMV and CERTIFICATE folders) or an mkv remux (using Makemkv) ?
Kuler087
28th April 2022, 15:49
I have some 4k Bluray backups as untouched mkv remuxes (using MakeMKV) that I would like to play on my Oppo 203.
So if I play the mkv directly it works except I get only HDR but no DV. If I mux it into .ts with the latest Tsmuxer the problem is solved I get DV but there is no TrueHD only DD.
Is this the limitation of the .ts container or something related to the oppo ?
Any workaround I could use to get Lossless Audio + DV working from these mkvs remuxed again with Tsmuxer into something on my oppo 203 ?
Thanks !
MakeMKV split the AC3 core from TrueHD.
The trueHD track need a core to be playable on bluray players.
You can merge one with thdmerge (https://forum.doom9.org/showthread.php?p=1965067#post1965067) or encode one with eac3to (https://www.videohelp.com/software/eac3to)
yannick92
29th April 2022, 09:30
Hello
I just noticed a change for "default settings" on the latest versions:
When opening a file I now have "Do not change SEI and VUI data" and the box "Continually insert SPS/PPS" not checked??
Is this normal?
Before, and since always it seems to me, at least until version git-2f0fdbf (?), I always had by default: "insert SEI and VUI data if absent" and the box checked for "Continually insert SPS/PPS "
Should I be worried about these changes?
Will this have an impact on file playback? (Playback usb HDD mainly on a PS3 (.m2ts).
Do I have to manually reset the old settings?
I admit that I never touched these parameters because I had read in the past that it was necessary not to touch them for correct playback on a PS3?...
Thanks in advance for your clarifications.
Yannick
SeeMoreDigital
29th April 2022, 09:51
Was your source file before using tsmuxer a full Bluray (with BDMV and CERTIFICATE folders) or an mkv remux (using Makemkv) ?
I've done both...
MrVideo
30th April 2022, 05:47
For those of you looking to add black bars to 4K UHD videos, why not look at using JDobbs' NVENCCRE program? Info is here: https://forum.doom9.org/showpost.php?p=1960157&postcount=31022
As noted in the posting, you need a nVidia card that supports re-encoding. I have the GTX 1660. Get a card that supports IDR/B/P frames.
Here is my NVENCCRE.INI file:
[Paths]
WorkingPath=E:\BD-REBUILDER\WORK\
[Options]
VIDEO_CODEC=1
AUDIO_CODEC=0
USE_EXTERNAL_SUBS=0
NVENC_CAPABLE=1
VIDEO_MODE=5
HEVC_BR_VALUES=10000,12000,24000
AVC_BR_VALUES=10000,12000,24000
# 1576:
#ENCODE_CUSTOM=--vpp-pad 0,292,0,292
# 1584:
#ENCODE_CUSTOM=--vpp-pad 0,288,0,288
# 1588:
#ENCODE_CUSTOM=--vpp-pad 0,286,0,286
# 1600:
#ENCODE_CUSTOM=--vpp-pad 0,280,0,280
# 1606:
#ENCODE_CUSTOM=--vpp-pad 0,276,0,278
# 1608:
#ENCODE_CUSTOM=--vpp-pad 0,276,0,276
# 1910:
#ENCODE_CUSTOM=--vpp-pad 0,124,0,126
# 2076:
#ENCODE_CUSTOM=--vpp-pad 0,42,0,42
# 2080:
#ENCODE_CUSTOM=--vpp-pad 0,40,0,40
I uncomment the line that matches the video that needs re-coding. If it isn't in the list, just add it (manually). BTW, it is left,top,right,bottom. Be sure the comment the lines for files that don't need black added.
Fine print: I have no clue as to what happens with DV videos. My projector doesn't do DV (none do), so I try not to deal with those files.
P.S.: It is fast.
d3rd3vil
30th April 2022, 23:02
I can already see that it doesnt work with DV as it lets you select 3 quality options.
4k DV is a VERY sensitive matter not some old 1080p shit or sth.
Kuler087
1st May 2022, 01:44
you can use the DoVi_tool (https://github.com/quietvoid/dovi_tool) to inject back the metadata
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.