ffmpeg 合并 MP4和MP3文件
ffmpeg -i 'hhl2.mp4' -i 'hhl.wav' -c:v copy -c:a aac -strict experimental -map 0:v:0 -map 1:a:0 hhl-audio.mp4
必须指定映射的输入流:
You'll have to map the input streams:
ffmpeg -i video.mp4 -i genaudio.mp3 -map 0:v -map 1:a -c:v copy -c:a copy output.mp4 -y
当输入的内容有多个同类型的streams时候, ffmpeg会找‘最好’的那个。audio就是最多数的频道。如果他们是相同的,它会找最早输入的stream.
When the inputs have multiple streams of a type among them, ffmpeg picks the 'best' one. For audio, that's the one with most number of channels. If those are the same, then it picks a stream from the earliest input.
不需要去重新编码audio. 直接copy就行。
(No need to re-encode the audio, so I've switched to copy)
在处理mp3的时候,提示:
在处理mp3的时候,提示:
> ffmpeg -i shuibanwo.mp3 -c:a aac -b:a 32k output.m4a -y Could not find tag for codec h264 in stream #0, codec not currently supported in container Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument Error initializing output stream 0:1 --
通过ffmpeg查看mp3既然是 Video
hw@hw-s:~/Downloads$ ffmpeg -i music/shuibanwo.mp3
Duration: 00:04:13.99, start: 0.025056, bitrate: 130 kb/s
Stream #0:0: Audio: mp3, 44100 Hz, stereo, fltp, 128 kb/s
Metadata:
encoder : LAME3.97
Stream #0:1: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 240x240 [SAR 1:1 DAR 1:1], 90k tbr, 90k tbn (attached pic)
下面这个mp4是audio
hw@hw-s:~/Downloads$ ffmpeg -i music/mm.mp4
Duration: 00:00:31.48, start: -0.021333, bitrate: 131 kb/s
Stream #0:0[0x1](eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 16 kb/s (default)
Metadata:
handler_name : Bento4 Sound Handler
vendor_id : [0][0][0][0]
所以不能被文件后缀骗了。。。
阅读量: 645
发布于:
修改于:
发布于:
修改于: