如何将.mp4视频与.wav音频结合使用ffmpeg中的偏移量从命令行? [英] How to combine a .mp4 video with a .wav audio with an offset in ffmpeg from command line?
问题描述
我一直在尝试将它们与ffmpeg和然后使用Flash播放器(只能采用h264格式)在线播放。
完成此操作最好的ffmpeg命令是什么?我的输入是MP4视频,WAV音频,以及音频评论开始相对于mp4视频开始的时间的偏移量。
我尝试了
ffmpeg -i input_audio.wav -i input_vid.mp4 -vcodec copy output.mp4
/ pre>
和
ffmpeg -vcodec copy -ss offset - 我输入_audio.wav -i input_video.mp4 output.mp4
h264格式的视频对于flash播放器是有好处的 - 有没有办法通过ffmpeg中的命令行执行此操作?
解决方案在ffmpeg中,音频媒体流可以使用
-itsoffset
选项进行延迟,如下所示:ffmpeg -i input_vid.mp4 -itsoffset 00:00:05.0 -i input_audio.wav
-vcodec copy -acodec copy output.mp4
要更改视频或音频编解码器,请在
-vcodec
和-acodec
选项。此命令将使用h264和mp3生成输出视频:ffmpeg -i input_vid.mp4 -itsoffset 00:00:05.0 -i input_audio.wav
-vcodec libx264 -acodec libmp3lame output.mp4
请参阅删除音频或视频了解更多信息。
I've got a TV clip in mp4 format containing audio and video, and an WAV audio_commentary track.
I've been trying to combine them in ffmpeg and then play it online with a flash player (which can only take h264 format)
What's the best ffmpeg command to accomplish this? My inputs are MP4 video, WAV audio, and an offset in seconds, the time the audio commentary starts relative to the start of the mp4 video.
I tried
ffmpeg -i input_audio.wav -i input_vid.mp4 -vcodec copy output.mp4
and
ffmpeg -vcodec copy -ss offset -i input_audio.wav -i input_video.mp4 output.mp4
nether of these do what I want and output the video in the h264 format that is good for flash players- Is there a way to do this from command line in ffmpeg?
解决方案In ffmpeg audio media stream can be delayed with
-itsoffset
option as the following:ffmpeg -i input_vid.mp4 -itsoffset 00:00:05.0 -i input_audio.wav -vcodec copy -acodec copy output.mp4
To change video or audio codecs, specify them in
-vcodec
and-acodec
options. This command will produce output video using h264 and mp3:ffmpeg -i input_vid.mp4 -itsoffset 00:00:05.0 -i input_audio.wav -vcodec libx264 -acodec libmp3lame output.mp4
See delaying the audio or the video for more information.
这篇关于如何将.mp4视频与.wav音频结合使用ffmpeg中的偏移量从命令行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!