Mixing commentary mp3 into mp4 gameplay video?
Hello, would you help me build a working ffmpeg command line, please?
I have two files, a 1080p .mp4 with video/audio and a .mp3 with audio that I want to mix into the main audio stream of the .mp4. This is for Youtube. I want to stream-copy the video stream and not re-encode it. I also need to increase the volume level of the audio in the .mp4 by %100 and the volume level in the. mp3 by %50. Both audio streams are 128kibt/48khz. I'd like to bump that to 192kbit in the final mp4. The .mp3 is commentary for the video that my capture card does not mix into the .mp4 that has only game audio. What command line do I need to use? Thank you a whole lot for your time!! This will save me many, many hours of needlessly re-encoding videos with Sony Vegas just to mix the audio streams. My videos are too long to do this very often.
I'm new to ffmpeg, but here is what I tried as a simple test and the output I got:
E:vidtest>ffmpeg -i 20120622171922.mp4 -map v:0.1 -vcodec copy -i 20120622171922
.mp3 -map a:0 test1.mp4
FFmpeg version SVN-r25099, Copyright (c) 2000-2010 the FFmpeg developers
built on Sep 11 2010 03:32:41 with gcc 4.4.2
configuration: --extra-cflags=-I/usr/i686-mingw32/include/ --extra-ldflags=-L/
usr/i686-mingw32/lib/ --extra-cflags=-U__STRICT_ANSI__ --extra-cflags=-D_MT --en
able-memalign-hack --arch=x86 --target-os=mingw32 --cross-prefix=i586-mingw32msv
c- --enable-runtime-cpudetect --enable-gpl --enable-version3 --enable-w32threads
--enable-libmp3lame --enable-libvorbis --enable-libopencore_amrwb --enable-libo
pencore_amrnb --enable-libfaac --enable-avisynth --enable-static --disable-share
libavutil 50.26. 0 / 50.26. 0
libavcore 0. 9. 0 / 0. 9. 0
libavcodec 52.88. 0 / 52.88. 0
libavformat 52.78. 4 / 52.78. 4
libavdevice 52. 2. 2 / 52. 2. 2
libavfilter 1.38. 3 / 1.38. 3
libswscale 0.11. 0 / 0.11. 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x3cbf20] multiple edit list entries, a/v desync migh
t occur, patch welcome
Last message repeated 1 times
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '20120622171922.mp4':
major_brand : mp42
minor_version : 2
Duration: 00:01:50.87, start: 0.005958, bitrate: 20181 kb/s
Stream #0.0(eng): Audio: aac, 48000 Hz, stereo, s16, 256 kb/s
Stream #0.1(eng): Video: h264, yuv420p, 1920x1080 [PAR 1:1 DAR 16:9], 19926
kb/s, 29.97 fps, 29.97 tbr, 180k tbn, 59.94 tbc
[mp3 @ 0x3b11db0] max_analyze_duration reached
[mp3 @ 0x3b11db0] Estimating duration from bitrate, this may be inaccurate
Input #1, mp3, from '20120622171922.mp3':
Duration: 00:01:51.45, start: 0.000000, bitrate: 128 kb/s
Stream #1.0: Audio: mp3, 48000 Hz, 2 channels, s16, 128 kb/s
File 'test1.mp4' already exists. Overwrite ? [y/N] y
Output #0, mp4, to 'test1.mp4':
Stream #0.0: Video:  / 0x0000, q=2-31, 200 kb/s, 90k tbn
Stream #0.1: Audio: libfaac, 48000 Hz, 2 channels, s16, 64 kb/s
Codec type mismatch for mapping #0.0 -> #0.0
I realize this is an old build. The updated ffmpeg I downloaded didn't have stream copy codec available. Again thank you for your time.
ps. In addition is it possible using ffmpeg to insert a video (and audio) 'intro' sequence at the beginning without having to re-encode the video stream? If so, how? Thank you very much!
ffmpeg isn't really designed for mixing audio tracks, at best it can trim audio levels and remap streams/channels.
A better approach would be to split out the audio streams to separate files, and then use something like sox or ecasound to process and mix them as desired to a new file, and then use ffmpeg to encode/mux the video stream and new audio file together.