Replace video audio with FFmpeg
If you want to replace the audio after you export the music video… Video software (using the Premire) to re-export troublesome, I finally found to examine the ffmpeg!
1 |
FFmpeg-I *. MP4-I *. wav-c:v copy-c:a AAC-Strict experimental-map 0: v-map 1: a Output.mp4 |
The video is copied and the audio is AAC encoded, and the processing ends soon!
目次
I was allowed to reference
Guide to video editing with FFmpeg-Moriyoshi Diary
Supplement
Until we reach the top way…
Separate and join
Extract only the video from the original video and then combine another voice… .
1 2 |
Ffmpe-I Track40.mp4-an-vcodec copy Mov.mp4 FFmpeg-I mov.mp4-I Track41.wav test.mp4 |
It takes time that the video is encoded by this method of joining.
I tried to find a way to combine it with copy, so I got an error.
Error 1
-Vcodec copy-acodec copy
1 |
FFmpeg-I Mov.mp4-vcodec copy-i Track40.wav-acodec copy Test2.mp4 |
Error
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
FFmpeg version git-2014-08-29-be3d807 Copyright (c) 2000-2014 the FFmpeg developers Built on Aug 29 2014 20:10:37 with Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4 svn) Configuration:--prefix =/users/username--Libdir =/users/username/lib--Incdir =/users/username/include-- ENABLE-LIBFAAC--enable-libx264--enable-libxvid--enable-nonfree--ENABLE-GPL--enable-libmp3lame--Enable-pthreads --ENABLE-LIBVPX--enable-libvorbis--disable-mmx--enable-shared--Enable-libtheora--pkg-config-pkg-config-- Enable-version3--enable-pic--extra-cflags =-I/users/username/include--extra-ldflags =-L/Users/username/lib Libavutil 54. 7.100/54. 7.100 Libavcodec 56. 1.100/56. 1.100 Libavformat 56. 3.100/56. 3.100 Libavdevice 56. 0.100/56. 0.100 Libavfilter 5. 0.103/5. 0.103 Libswscale 3. 0.100/3. 0.100 Libswresample one. 1.100/1. 1.100 Libpostproc 53. 0.100/53. 0.100 Input #0, MOV, MP4, M4A, 3GP, 3g2, mj2, from ' Track42.mp4 ': Metadata Major_brand: mp42 Minor_version: 0 Compatible_brands: mp42mp41 Creation_time: 2018-12-12 18:36:52 Duration: 00:04:42.77, Start: 0.000000, bitrate: 16329 kb/s Stream #0:0 (Eng): Video: H264 (High) (AVC1/0x31637661), yuv420p (TV, bt709), 1280x720[SAR 1:1 DAR 16:9], 16009 kb/s, 29.97 fps, 29.97 TBR, 30k TBN, 59.94 TBC (default) Metadata Creation_time: 2018-12-12 18:36:52 Handler_name: Alias Data Handler Encoder: AVC Coding Stream #0:1 (Eng): Audio: AAC (MP4A/0x6134706d), 44100 Hz, stereo, FLTP, 317 kb/s (default) Metadata Creation_time: 2018-12-12 18:36:52 Handler_name: Alias Data Handler Unknown decoder ' copy ' |
Error 2
Another way of examining
1 |
FFmpeg-I Track42.mp4-i Track42.wav-c:v copy-c:a AAC-map 0: v:0-map 1: a:0 output2.mp4 |
A little different error
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
FFmpeg version git-2014-08-29-be3d807 Copyright (c) 2000-2014 the FFmpeg developers Built on Aug 29 2014 20:10:37 with Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4 svn) Configuration:--prefix =/users/username--Libdir =/users/username/lib--Incdir =/users/username/include-- ENABLE-LIBFAAC--enable-libx264--enable-libxvid--enable-nonfree--ENABLE-GPL--enable-libmp3lame--Enable-pthreads --ENABLE-LIBVPX--enable-libvorbis--disable-mmx--enable-shared--Enable-libtheora--pkg-config-pkg-config-- Enable-version3--enable-pic--extra-cflags =-I/users/username/include--extra-ldflags =-L/Users/username/lib Libavutil 54. 7.100/54. 7.100 Libavcodec 56. 1.100/56. 1.100 Libavformat 56. 3.100/56. 3.100 Libavdevice 56. 0.100/56. 0.100 Libavfilter 5. 0.103/5. 0.103 Libswscale 3. 0.100/3. 0.100 Libswresample one. 1.100/1. 1.100 Libpostproc 53. 0.100/53. 0.100 Input #0, MOV, MP4, M4A, 3GP, 3g2, mj2, from ' Track42.mp4 ': Metadata Major_brand: mp42 Minor_version: 0 Compatible_brands: mp42mp41 Creation_time: 2018-12-12 18:36:52 Duration: 00:04:42.77, Start: 0.000000, bitrate: 16329 kb/s Stream #0:0 (Eng): Video: H264 (High) (AVC1/0x31637661), yuv420p (TV, bt709), 1280x720[SAR 1:1 DAR 16:9], 16009 kb/s, 29.97 fps, 29.97 TBR, 30k TBN, 59.94 TBC (default) Metadata Creation_time: 2018-12-12 18:36:52 Handler_name: Alias Data Handler Encoder: AVC Coding Stream #0:1 (Eng): Audio: AAC (MP4A/0x6134706d), 44100 Hz, stereo, FLTP, 317 kb/s (default) Metadata Creation_time: 2018-12-12 18:36:52 Handler_name: Alias Data Handler Guessed Channel Layout for Input Stream #1 .0: Stereo Input #1, WAV, from ' Track42.wav ': Duration: 00:04:44.38, bitrate: 1411 kb/s Stream #1:0: Audio: Pcm_s16le [1][0][0][0](/0x0001), 44100 Hz, 2 channels, S16, 1411 kb/s File ' Output2.mp4 ' already exists. Overwrite?[y/N] Y [aac @ 0x7fe28985da00] The encoder ' AAC ' is experimental but experimental codecs are not enabled, add '-strict-2 ' If you want to use it. [aac @ 0x7fe28985da00] Alternatively use the non experimental encoder ' LIBFAAC '. |