Eu tenho dois arquivos, video.mp4 e genaudio.mp3 (ambos do mesmo tamanho). Como posso mesclar o arquivo MP3 com o MP4 usando o FFMPEG (ou qualquer programa de linha de comando)?
Isso é o que eu tenho até agora, mas não substitui o áudio depois de cuspi-lo:
ffmpeg -i video.mp4 -i genaudio.mp3 -c:v copy -c:a mp3 output.mp4 -y
(- y é para sobrescrever automaticamente o arquivo output.mp4 existente)
Editar: e se for de alguma ajuda, aqui está a saída do console:
C:\Apps\ffmpeg-20180224-28924f4-win64-static\bin>ffmpeg -i video.mp4 -i genaudio.mp3 -c:v copy -c:a mp3 output.mp4 -y
ffmpeg version N-90155-g28924f4b48 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 7.3.0 (GCC)
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libmfx --enable-amf --enable-cuda --enable-cuvid --enable-d3d11va --enable-nvenc --enable-dxva2 --enable-avisynth
libavutil 56. 7.101 / 56. 7.101
libavcodec 58. 12.102 / 58. 12.102
libavformat 58. 9.100 / 58. 9.100
libavdevice 58. 2.100 / 58. 2.100
libavfilter 7. 12.100 / 7. 12.100
libswscale 5. 0.101 / 5. 0.101
libswresample 3. 0.101 / 3. 0.101
libpostproc 55. 0.100 / 55. 0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
creation_time : 2018-02-25T09:00:48.000000Z
Duration: 00:00:16.02, start: 0.000000, bitrate: 8239 kb/s
Stream #0:0(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 188 kb/s (default)
Metadata:
creation_time : 2018-02-25T09:00:48.000000Z
handler_name : Mainconcept MP4 Sound Media Handler
Stream #0:1(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv), 720x720 [SAR 1:1 DAR 1:1], 8047 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
Metadata:
creation_time : 2018-02-25T09:00:48.000000Z
handler_name : Mainconcept MP4 Video Media Handler
encoder : AVC Coding
[mp3 @ 00000220343de600] Estimating duration from bitrate, this may be inaccurate
Input #1, mp3, from 'genaudio.mp3':
Metadata:
genre : Other
Duration: 00:00:16.07, start: 0.000000, bitrate: 320 kb/s
Stream #1:0: Audio: mp3, 44100 Hz, stereo, s16p, 320 kb/s
Stream mapping:
Stream #0:1 -> #0:0 (copy)
Stream #0:0 -> #0:1 (aac (native) -> mp3 (libmp3lame))
Press [q] to stop, [?] for help
Output #0, mp4, to 'output.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
encoder : Lavf58.9.100
Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv), 720x720 [SAR 1:1 DAR 1:1], q=2-31, 8047 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 30k tbc (default)
Metadata:
creation_time : 2018-02-25T09:00:48.000000Z
handler_name : Mainconcept MP4 Video Media Handler
encoder : AVC Coding
Stream #0:1(eng): Audio: mp3 (libmp3lame) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp (default)
Metadata:
creation_time : 2018-02-25T09:00:48.000000Z
handler_name : Mainconcept MP4 Sound Media Handler
encoder : Lavc58.12.102 libmp3lame
frame= 480 fps=0.0 q=-1.0 Lsize= 16000kB time=00:00:16.03 bitrate=8174.9kbits/s speed=21.8x
video:15734kB audio:251kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.091419%
C:\Apps\ffmpeg-20180224-28924f4-win64-static\bin>