If I open a mxf file in audacity and save the WAV (original format) audio as a 320kbps aac file I can then encode the mxf file to a mp4 with the aac/m4a audio using the following ffmpeg command.
ffmpeg -i "D:\input.mxf" -i "D:\audo.m4a" -c:v h264_nvenc -r 50 -cq:v 18 -aspect 16:9 -pix_fmt yuv420p -vf "bwdif=mode=1" -acodec copy "D:\output.mp4"
but if I was to save the audio as a 640kbps .ac3 file using audacity too, how would I go about adding that as a second track to the mp4 file? I've tried just adding another input but I'm getting errors.
I need AAC for compatibility but there's a lot of talk online about ffmpeg's aac not being good quality, so I'd like a back up track that's apparently of better quality while still being smaller than the original wav (.wav wouldn't go in a mp4 container anyway).
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays! or rip iTunes movies!
+ Reply to Thread
Results 1 to 7 of 7
Thread
-
-
You need to use -map functionality
for example: https://stackoverflow.com/questions/62122503/can-ffmpeg-transcode-an-audio-track-and-a...rack-at-the-sa -
Here you go:
Code:ffmpeg -i "D:\input.mxf" -i "D:\audio.m4a" -i "D:\audio.ac3" -map 0:v -map 1:0 -map 2:0 -c:v h264_nvenc -c:a copy -r 50 -cq:v 18 -aspect 16:9 -pix_fmt yuv420p -vf "bwdif=mode=1" "D:\output.mp4"
-
Thank you so much!
I'll give that a try.
I don't suppose there's a way I could remove audacity from my workflow completely. The mxf files I have have 16 mono channels (all empty bar the first two). I use audacity to make a stereo track using the first two mono channels and then that is what I save as aac / will also be saving as ac3.
Is there a way to instruct ffmpeg to encode using the first two mono channels and map to stereo e.g. 1/FL 2/FR? Encoding both a AAC and a AC3 track with them. -
Yes, check this:
https://trac.ffmpeg.org/wiki/AudioChannelManipulation#a2monostereo
Bellow example how it may look in ffmpeg - not tested as i have no similar source to yours - ffmpeg can be tricky in such things but definitely it is doable.
Code:ffmpeg -i "D:\input.mxf" -filter_complex "[0:a:0][0:a:1]join=inputs=2:channel_layout=stereo,asplit=2[audio_1][audio_2];[0:v]bwdif=mode=1[video]" -map "[video]" -c:v h264_nvenc -r 50 -cq:v 18 -aspect 16:9 -pix_fmt yuv420p -map "[audio_1]" -c:a:1 libfdk_aac -b:a:1 320k -map "[audio_2]" -c:a:2 ac3 -b:a:2 640k "D:\output.mp4"
Last edited by pandy; 13th May 2024 at 17:44.
-
Thanks Pandy. I'll give that a try asap. Will have to change from libfdk to the standard aac encoder as my ffmpeg is not compiled with libfdk. That's one of the reasons I have to have the ac3 track as back-up as apparently the standard aac encoder in ffmpeg isn't that good (How much credence would you give these claims? There's conflicting advice online with some saying it's got better and others advising against its use and to use libfdk instead). Compiling ffmpeg sounds a bit too complicated for me so I just use the standard installation.
-
Well... just use nonfree ffmpeg version with libfdk compiled in ( search for "Automated nonfree builds of FFmpeg for Windows" ). AC3 is definitely way more popular and widely supported by almost all consumer decoders. I have impression that with 320kbps even generic ffmpeg aac encoder should be OK.
Similar Threads
-
clever FFmpeg-GUI Error When Input Video Encoded With VP09?
By meeshu in forum EditingReplies: 16Last Post: 18th Mar 2024, 07:14 -
Need an ffmpeg batch file to convert m4a to ac3
By DarrellS in forum AudioReplies: 7Last Post: 28th Sep 2023, 11:42 -
What does this FFMPEG input mean?
By Guernsey in forum Newbie / General discussionsReplies: 3Last Post: 13th Oct 2022, 08:18 -
Input transparent pipe:0 motions into FFMPEG
By ntphcm in forum Video ConversionReplies: 0Last Post: 29th Sep 2021, 02:14 -
How to Batch Process 768kbps DTS .m4a Audio Files to AC3 5.1ch 640Kbps
By askfriends in forum AudioReplies: 5Last Post: 4th Aug 2021, 06:17