0

I have a 8 audio track mov file which I want to encode to mp4 using ffmpeg BUT take the tracks 7+8 and put them as stereo with 320k and 48KHz to that mp4. My line is this:

ffmpeg -i %source% -map 0:0 -map 0:7 -map 0:8 -c:a:0 aac -ab:1 320k -ar:1 48000 -ac:1 2 -disposition:a:0 default -c:a:1 aac -ab:2 320k -ar:2 48000 -ac:2 1 -disposition:a:1 0 -strict -2 -async 1 -c:v libx264 -b:v 9300k -minrate 9300k -maxrate 9300k -bufsize 2325k -r 24 -force_fps -s 1920x1080 -aspect 1:1 -pix_fmt yuv420p -profile:v high -preset medium -level 40 -partitions partb8x8+partp4x4+partp8x8+parti8x8 -b-pyramid 2 -weightb 1 -8x8dct 1 -fast-pskip 1 -direct-pred 1 -x264-params force-cfr=1 -coder ac -trellis 1 -me_method hex -flags +loop -sc_threshold 40 -keyint_min 24 -g 240 -qmin 3 -qmax 51 -threads 12 -metadata creation_time=now -sn -y %source%_FINAL.mp4

What do I have to change in order to make it stereo instead of 2 mono? I tried adding-filter_complex "[0:7][0:8] amerge=inputs=2" c:a aac -ab 320k at the beginning but it didnt work. What am I doing wrong? Thanks.

0

Try something like this:

1) Merge Audio Tracks 7 and 8, put it in Audio Track 1, discard other Audio Tracks from source:

ffmpeg -i "in.mxf" -filter_complex "[0:7][0:8]amerge=inputs=2[mergedAudio]" -map 0:v -map "[mergedAudio]" "out.mp4"

In some cases you might add the option -ac 2 between the end-" of filter complex and the 1st map.

2) 1) combined with all (useful) parameters of your code:

ffmpeg -i "in.mov" -filter_complex "[0:7][0:8]amerge=inputs=2[mergedAudio]" -map 0:v -map "[mergedAudio]" -ac 2 -c:a aac -b:a 320k -ar 48000 -disposition:a:0 default -strict -2 -c:v libx264 -b:v 9300k -minrate 9300k -maxrate 9300k -bufsize 2325k -r 24 -force_fps -s 1920x1080 -aspect 1:1 -pix_fmt yuv420p -profile:v high -preset medium -level 40 -partitions partb8x8+partp4x4+partp8x8+parti8x8 -b-pyramid 2 -weightb 1 -8x8dct 1 -fast-pskip 1 -direct-pred 1 -x264-params force-cfr=1 -coder ac -trellis 1 -me_method hex -flags +loop -sc_threshold 40 -keyint_min 24 -g 240 -qmin 3 -qmax 51 -threads 12 -metadata creation_time=now -sn -y FINAL.mp4

You had a space in your bitrate -ab:1 320k. I have changed it to the current syntax -b:a 320k

Same with -ar:1 48000 -> -ar 48000

Removed -async 1 because it threw an error

10
  • Thanks drake7 but where do I put it to the above long line so I have everything I need (video and audio) in one command? I tried it but did not work. Thanks.
    – Yannis
    Apr 2 '20 at 9:52
  • Can you provide your file? If it's too big you can limit the duration to 5 seconds: ffmpeg -i "in.mxf" -map 0 -c copy -t 5 "sample10s.mxf (I assume it's .mxf but use whatever file extension your source has)
    – drake7
    Apr 2 '20 at 10:00
  • I can but how should I send it to you?
    – Yannis
    Apr 2 '20 at 13:30
  • You can e-mail me with a service like wetransfer or upload it to something like uploadfiles.io. I've added my e-mail to my profile info.
    – drake7
    Apr 2 '20 at 15:15
  • Thanks Drake, I just did on your email.
    – Yannis
    Apr 2 '20 at 15:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.