Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
17th November 2017, 11:29 | #1 | Link |
Acid fr0g
Join Date: May 2002
Location: Italy
Posts: 2,580
|
Proper way to FFMPEG DTS-MA 7.1 to AC3 5.1?
I have googled lot of sites but didn't find answer.
Is possible to use ffmpeg to convert a DTS-MA 7.1 file to AC3 5.1 (640kbps) with proper channel mapping and mixdown? Eac3to gives me error and ffmpeg seems my only viable way...
__________________
@turment on Telegram |
17th November 2017, 22:53 | #4 | Link |
Moderator
Join Date: Feb 2005
Location: Spain
Posts: 6,915
|
ffmpeg and eac3to (-down6) can do the job.
But when downmix the overall volume can be reduced, to avoid clip when SL,BL and SR,BR are mixed. I can recommend a special AviSynth downmix to preserve the full volume in FL,FR,FC,LFE channels. In short something like: Code:
# Downmix 7.1 to 5.1 function 71to51(clip a) { flr = Getchannel(a, 1, 2, 3, 4) blr = Getchannel(a, 5, 6) slr = Getchannel(a, 7, 8) sur = MixAudio(blr, slr, 1.0, 1.0).SoftClipperFromAudX(0.0) return mergechannels(flr,sur) } For instance in MeGUI with a DTS-HD source:
__________________
BeHappy, AviSynth audio transcoder. |
18th November 2017, 11:23 | #5 | Link | |
Acid fr0g
Join Date: May 2002
Location: Italy
Posts: 2,580
|
Quote:
I never used AVS to encode/decode audio.
__________________
@turment on Telegram |
|
18th November 2017, 12:39 | #6 | Link |
Moderator
Join Date: Feb 2005
Location: Spain
Posts: 6,915
|
That avs function split the channels in:
flr = Getchannel(a, 1, 2, 3, 4) # channels FL, FR, FC, LFE blr = Getchannel(a, 5, 6) # channels BL, BR slr = Getchannel(a, 7, 8) # channels SL, SR Now mix channels BL with SL, BR with SR sur = MixAudio(blr, slr, 1.0, 1.0) The mix is at full volume (1.0) and can produce clip if sum of volumes is greater than 1.0 (float samples are used at this point) And apply a plugin (Audiolimiter.dll) to reduce volume only if clip is detected, to limit max volume at 1.0: sur = sur.SoftClipperFromAudX(0.0) and finally return the 6 channels without changes in 'flr' return mergechannels(flr,sur) Then most the time the volume in 'sur' is the same than in the 4 surround channels, and the global balance between front and surround is preserved. Only in clip points the balance is lost and 'sur' (two speakers) can't produce the same volume than BL,BR,SL,SR (four speakers). The standard way to mix 7.1 -> 5.1 is lower the volume of ALL channels to prevent clips and you have correct balance in all the movie but at half volume.
__________________
BeHappy, AviSynth audio transcoder. Last edited by tebasuna51; 18th November 2017 at 13:40. Reason: add info |
18th November 2017, 13:15 | #7 | Link |
Moderator
Join Date: Feb 2005
Location: Spain
Posts: 6,915
|
OTHER QUESTIONS:
- That MeGUI method work also for 6.1 sources (other fuction 61to51 is selected) and DTS-HR 96 KHz (Change to 48000, than do nothing if it is already 48000). - The LWLibavAudioSource can decode many audio sources (DTS-HD, TrueHD, FLAC, AAC, ...), and also the first audio track of containers like m2ts or mkv. - You can include other parameters to ffmpeg encoder in Extra Tab, for instance I recommend: -center_mixlev 0.707 to override the ffmpeg default 0.594604, to low for me, used if decoder need downmix to stereo that 5.1.
__________________
BeHappy, AviSynth audio transcoder. Last edited by tebasuna51; 18th November 2017 at 14:16. |
19th November 2017, 10:46 | #9 | Link |
Moderator
Join Date: Feb 2005
Location: Spain
Posts: 6,915
|
The same than video, with a proper spliter/decoder.
The plugin LSMASHSource.dll (also ffms2.dll) have functions: LWLibavVideoSource("inputfile",...) LWLibavAudioSource("inputfile",...) ... It convert many sources to uncompressed PCM samples than can be managed inside AviSynth with internal Audio processing filters and with external Audio filters You can see the docs for full explain.
__________________
BeHappy, AviSynth audio transcoder. Last edited by tebasuna51; 19th November 2017 at 10:49. Reason: typo |
19th November 2017, 12:12 | #10 | Link | |
Life's clearer in 4K UHD
Join Date: Jun 2003
Location: Notts, UK
Posts: 12,227
|
Quote:
Cheers
__________________
| I've been testing hardware media playback devices and software A/V encoders and decoders since 2001 | My Network Layout & A/V Gear |
|
|
20th November 2017, 10:44 | #14 | Link |
Life's clearer in 4K UHD
Join Date: Jun 2003
Location: Notts, UK
Posts: 12,227
|
Okay...
Have you considered using the 5.1 DTS core as a source to generate your 5.1 AC3 encode?
__________________
| I've been testing hardware media playback devices and software A/V encoders and decoders since 2001 | My Network Layout & A/V Gear |
|
21st November 2017, 19:50 | #16 | Link | |
Life's clearer in 4K UHD
Join Date: Jun 2003
Location: Notts, UK
Posts: 12,227
|
Quote:
Unless tormento has a well spec'd surround sound set-up (which he can't have or he'd be keeping the original DTS-MA stream or using the DTS core), he's unlikely to hear that much of a difference!
__________________
| I've been testing hardware media playback devices and software A/V encoders and decoders since 2001 | My Network Layout & A/V Gear |
|
|
13th February 2021, 03:04 | #17 | Link | |
Registered User
Join Date: May 2017
Posts: 18
|
Quote:
Only for 6.1 / 5.1 to 2.0 audio conversions or should it also be used for 2.0 to 2.0 audio conversions? I ask this because I went to change the speed of a DDP audio (EAC3) with eac3to.exe the conversion was carried out, but however the command was not applied. Last edited by Vicio; 13th February 2021 at 03:07. |
|
13th February 2021, 14:14 | #18 | Link | |
Moderator
Join Date: Feb 2005
Location: Spain
Posts: 6,915
|
Quote:
My template is for ac3 encode, you can change it for eac3 but you can delete also that parameter. 2) In ac3 2.0 bsi header also don't exist the field center_mixlevel, you can also delete it. My template is for multichannel because for 2.0 always recommend recode to AAC. BTW ffmpeg yelow warnings aren't a problem, are only info.
__________________
BeHappy, AviSynth audio transcoder. |
|
13th February 2021, 15:30 | #19 | Link |
Moderator
Join Date: Feb 2005
Location: Spain
Posts: 6,915
|
To change duration of audio tracks you can use UsEac3to and ffmpeg without eac3to.
Sometimes eac3to can't decode the source track or you want preserve the pitch of the track (eac3to change the pitch when you change the audio duration). See the image. You want change the EAC3 english track. 1) Use the 'More parameters' -> F-FFMPEG -> Add or write directly in 'COMMAND LINE PARAMETERS' the ffmpeg audio filter: -af "atempo=1.001" with: Code:
fps's video TimeStretch ffmpeg ---------------- ------------------- 23.976 -> 25.000 1.042708 speedup 23.976 -> 24.000 1.001 24.000 -> 25.000 1.041667 24.000 -> 23.976 0.999001 25.000 -> 24.000 0.96 25.000 -> 23.976 0.959041 slowdown 3) Select the track to modify. Remember ffmpeg start by track '0' then the eac3to track 3: is the map=0:2 for ffmpeg 4) 'Add to DEC' the ffmpeg filter included in the 'COMMAND LINE PARAMETERS' 5) Select the output format and bitrate/quality: AC3, EAC3, AAC (recommended for 2.0), ... 6) 'Run' or 'EnQueue' - Like this thread is for Downmix 7.1 to 5.1 the method can be used also for that using the ffmpeg filter in 1): -filter_complex "asplit [f][s]; [f] pan=3.1|c0=c0|c1=c1|c2=c2|c3=c3 [r]; [s] pan=stereo|c0=0.5*c4+0.5*c6|c1=0.5*c5+0.5*c7, compand=attacks=0:decays=0oints=-90/-84|-10/-4|-6/-2|-0/-0.3, aformat=channel_layouts=stereo [d]; [r][d] amerge [a]" -map "[a]" Remember, the is Code:
:p
__________________
BeHappy, AviSynth audio transcoder. Last edited by tebasuna51; 13th February 2021 at 15:41. |
14th February 2021, 00:05 | #20 | Link | |
Registered User
Join Date: May 2017
Posts: 18
|
Quote:
In fact, when it comes to handling EAC3 audios I really prefer BeHappy, I asked the question because I was surprised to see that in UsEac3to it was possible to change the speed of this audio format as well. When I saw that he did not apply the command “-center_mixlev 0.707” to the EAC3 audio, I was in doubt if the command was really necessary for 2.0 audios But now with your explanation I know that it is intended for multichannel only. Greetings from Brazil. |
|
|
|