Hello guest, if you like this forum, why don't you register? https://fanrestore.com/member.php?action=register (December 14, 2021) x


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Editing DTS-HD Master Audio without transcoding
#1
I'm sure this question has been asked before. I have a DTS-HD MA track that I need to make some minor edits to, like trimming a little info throughout and adding a little back in. What's the best way of going about this without transcoding or quality loss? I can't imagine it would be converting it to FLAC and using something like Audacity, then converting back somehow? Thaanks.
Reply
Thanks given by:
#2
(2020-08-26, 02:01 PM)Kreeep Wrote: I'm sure this question has been asked before. I have a DTS-HD MA track that I need to make some minor edits to, like trimming a little info throughout and adding a little back in. What's the best way of going about this without transcoding or quality loss? I can't imagine it would be converting it to FLAC and using something like Audacity, then converting back somehow? Thaanks.

DTS-HD MA is lossless but it's not necessarily going to remain lossless if you start editing it directly because the lossy part at the very least (the DTS core) relies to a certain extent on adjacent frames to decode 100% accurately, and the lossless decode is not separate, it combines the lossy core with MLP data to extrapolate the rest.

So yes, you would be better to decode it to PCM (FLAC if you want to use that for storing it, but you'd need to decode that to PCM anyway to actually edit it). To get it back to DTS-HD MA you'd need the official DTS Suite because third party encoders don't do .dtshd, just lossy DTS. Depending on what you're doing, when you're doing it and how, I may be able to do the encoding part for you, but I'm about to go on holiday for a week so I might not be the best person to assist right now.

One note: be very careful exporting from Audacity because the default settings will dither the entire file from start to finish, which is also not ideal. What you ideally want is to dither only the portions that need it, which might be none of them depending on your edits. If you do stuff that affects gain ("volume" if you like) and uses the additional granular fidelity of 32-bit float editing (which is what Audacity and many other editors will generally default to, for good reason) then you need to dither those edit points but not necessarily the whole file. Audacity isn't really capable of selective dither ("auto-blanking"), I do it in non-free software. If you only do edits that won't need dithering applied, you'll want to export from Audacity with dither completely switched off, which you need to do in Settings before you export because Audacity rather annoyingly doesn't give you the option during the export process.
Reply
Thanks given by:
#3
The best way?

Transcode to PCM and edit away without worry in terms of editing.
Just make sure your project has the same settings as your source.
Reply
Thanks given by:
#4
Thanks for the replies guys. What would be the best way to convert to PCM? I typically use XRECODE for audio conversions. I'm hoping it's safe to use it to convert to a wave with the same settings as source.

Thanks for offering to help out pipefan. I appreciate it Smile What non-free software do you typically use for audio editing? I may need to do some selective dithering.

What I'm trying to do is get a couple of different audio tracks for a film to sync up 100%. To do this, I'm going to need to do some minor fade outs with a couple of frames and maybe even extend sound for a frame here and there also.

So, I'm guessing after completing my project, I would export as PCM and use DTS Suite to encode back to DTS-HD MA. I have the official DTS Suite myself but have never used it before.
Reply
Thanks given by:
#5
use eac3to or ffmpeg for transcoding to PCM (WAV)
Reply
Thanks given by:
#6
(2020-08-27, 11:14 AM)Kreeep Wrote: Thanks for the replies guys. What would be the best way to convert to PCM? I typically use XRECODE for audio conversions. I'm hoping it's safe to use it to convert to a wave with the same settings as source.

Thanks for offering to help out pipefan. I appreciate it Smile What non-free software do you typically use for audio editing? I may need to do some selective dithering.

What I'm trying to do is get a couple of different audio tracks for a film to sync up 100%. To do this, I'm going to need to do some minor fade outs with a couple of frames and maybe even extend sound for a frame here and there also.

So, I'm guessing after completing my project, I would export as PCM and use DTS Suite to encode back to DTS-HD MA. I have the official DTS Suite myself but have never used it before.

Yeah, eac3to is great (it's command line but extremely simple and if you really really hate CLI then there's a GUI you can use).

For the auto-blanking dither I use RX set to "auto-blanking when quantized". Personally, I avoid noise-shaping and generally use TPDF set to Normal but with the auto-blanking on so that it uses a straightforward non-shaped dither and only when it's needed to avoid quantisation errors.
Reply
Thanks given by:
#7
Alrighty. I'll use eac3to. Thanks. I tried using XRECODE and it did the job but for whatever reason, DTS Suite didn't support it.


(2020-08-27, 12:36 PM)pipefan413 Wrote: For the auto-blanking dither I use RX set to "auto-blanking when quantized". Personally, I avoid noise-shaping and generally use TPDF set to Normal but with the auto-blanking on so that it uses a straightforward non-shaped dither and only when it's needed to avoid quantisation errors.


I won't lie. I didn't understand the majority of that Tongue I'm very new to all of this but would like to get my head around it. I'm not expecting you to go into lengthy detail explaining though. I'll try and do some research myself too Smile





Another question. If I was to simply cut a few frames-worth of audio from the middle of a track, I could do that without need for conversion somehow?
Reply
Thanks given by:
#8
(2020-08-30, 04:57 AM)Kreeep Wrote: Alrighty. I'll use eac3to. Thanks. I tried using XRECODE and it did the job but for whatever reason, DTS Suite didn't support it.

(2020-08-27, 12:36 PM)pipefan413 Wrote: For the auto-blanking dither I use RX set to "auto-blanking when quantized". Personally, I avoid noise-shaping and generally use TPDF set to Normal but with the auto-blanking on so that it uses a straightforward non-shaped dither and only when it's needed to avoid quantisation errors.

I won't lie. I didn't understand the majority of that Tongue I'm very new to all of this but would like to get my head around it. I'm not expecting you to go into lengthy detail explaining though. I'll try and do some research myself too Smile

Another question. If I was to simply cut a few frames-worth of audio from the middle of a track, I could do that without need for conversion somehow?

"Didn't support" what and in what sense? The Suite reads the DTS-HD global header, but if you took an authored .dtshd stream and tried to load it into some part of the Suite for some reason or another, it won't take it because it's looking for the header but it isn't attached. All the metadata stuff (including the global header and a navigation table "footer" on the end) is stripped off when a disc is authored.

You can edit encoded streams in situ using delays. The free software delaycut works on this principle. It can be done by a lot of software but it is kind of an involved and manual process. You basically need to work out the exact point you want to edit but in terms of audio frames (DTS is usually 512 samples per frame for the most part) and time duration (in milliseconds) then apply positive and/or negative delays to chop the file into separate chunks, then you want to join them together (concatenation).

So if you want to trim a few video frames' worth from somewhere in the middle of a file, you have to know the exact point in time that the start of the first frame to trim is, and the end of the last frame to trim. If you know the exact numbers of those video frames (e.g. from QuickTime Player or something like AviSynth, both of which count frames starting at 0 rather than 1) then you can convert that to either time or audio samples by using the frame rate. If your frame rate is the most commonly used Blu-ray frame rate, sometimes called 23.976 fps (but more accurately 24000/1001 fps), then your calculations might look something like this...

To trim the audio to the start of the 500th video frame (which is functionally the same as the end of the 499th, since you're cutting off the first 499):

time duration = video frames / frame rate x conversion factor for time units if needed to get from seconds to something else e.g. milliseconds
(since fps is making seconds the unit of time)

= 499 / (24000/1001) x 1000
= 20812.4583333 milliseconds

You can't instruct software explicitly to cut by applying a negative delay of "-20812.4583333ms", but you *can* tell it to aim for the nearest whole number and it will automatically round to the nearest whole audio "frame". DTS on Blu-ray is usually 48 kHz with 512 samples to a frame, which we can use to check which frame at which we ideally want to cut, and use that to inform the number in ms that we give to the software:

audio samples = video frames / frame rate x sample rate

= 499 / (24000/1001) x 48000
(if sample rate is 48 kHz, which is 48000 samples per second)

= 998998 samples

998998 samples / 512 = 1951.16796875 DTS frames

So you need to decide whether it is better for the particular edit you want to make to round up or down, then convert back to milliseconds and feed that figure to the software's delay command. Let's say you decide to cut slightly less by rounding it down:

1951 DTS frames x 512 samples = 998912 samples

998912 samples / 48000 samples per second = 20.8106666666 seconds

20.8106666666 x 1000 = 20810.6666666 milliseconds

If you instruct eac3to to apply a delay of -20811ms it should round down to 20810.6666666 ms and cut at the 1951st DTS frame.

That obviously works for endpoints but not starts because it cuts off everything before the edit point, so an alternative method is needed for endpoints. You can do it in delaycut or something like MKVToolNix, just be conscious of the accuracy of the edit points. In my experience, MKVToolNix can sometimes be a tad unpredictable, but delaycut is pretty consistent as long as you get your timestamp exactly right. Again, similar principle, so you can use the above calculation method to figure out times in ms then feed those to delaycut.

EDIT: Forgot to say. The final concatenation can be done either in eac3to or just by standard OS file concatenation. In Linux it's "concat"; in Windows it's "copy /b". In eac3to you just use + to join the separate files.
Reply
Thanks given by: BDgeek
#9
Wooow. Sorry about the late reply and thanks very much for the detailed response.

Ah, yes. I did take an authored .dtshd stream, so it makes sense that DTS-Suite didn't understand what was going on. My bad. Very new to all of this.

For the couple of projects that I'm working on, I'll try my luck making some splits and joins with MKVToolNix before moving onto other techniques if I'm not happy with the result. Your calculations and explanation about DTS sample rate, etc will definitely come in handy, so thanks very much! Smile
Reply
Thanks given by:


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to use eac3to to edit AC3 to avoid transcoding bendermac 37 17,553 2024-11-24, 02:46 PM
Last Post: ilpubzo5ie
  [Help] How to apply delay to a whole video file, not just the video or audio streams? Red41804 7 2,257 2024-02-12, 11:03 AM
Last Post: Hitcher
Music [Help] Detect whether 2.0 Audio is Dual Mono or Stereo GjRedo 2 1,306 2023-12-09, 08:35 PM
Last Post: Doctor M
  Editing - Still "bit-perfect"? spaceboy710 13 7,186 2023-09-01, 06:26 PM
Last Post: Falcon
Question [Help] Slow down or speed up Audio for projects bendermac 18 7,418 2023-08-25, 01:59 AM
Last Post: Falcon
  [Help] 2 VHS Audio Captures to remove faults. CSchmidlapp 16 11,526 2023-07-03, 12:15 AM
Last Post: wongfeihung
  [Help] Identify and Repair an Audio Artifact axeyou 2 1,446 2023-06-14, 08:59 AM
Last Post: axeyou
  Preserving HDR/DV information when editing borisanddoris 10 4,957 2022-11-18, 10:33 PM
Last Post: BDgeek
  [Help] Automatically Sync The Audio From Another Source? Endocryne 1 1,829 2022-10-09, 09:47 AM
Last Post: Serums
  Looking for Video Editing Software Suggestions Doctor M 6 3,149 2022-09-06, 07:58 AM
Last Post: WXM

Forum Jump:


Users browsing this thread: 5 Guest(s)