[FFmpeg-user] Replacing First 90 Seconds of a Video with Silence or with Another Audio Clip
a@fumatic.org
a at fumatic.org
Wed Jan 20 03:17:49 CET 2016
On 01/18/2016 10:02 PM, Ryan Williams
wrote:
On Tuesday, 19 January 2016 02:13 Sam Logan <shapableline at gmail.com> wrote:
I have a video AVI file, "Video.avi", consisting of a video and an
audio track, and a separate audio file, "Audio.mp3". I want to do the
following two things:
(1)
First, I want to produce a version of the video, "OutputSilenced.avi",
which would be identical to the original video except that the first
90 seconds of the video's audio are replaced with silence (to clarify,
I want to REPLACE, as in overwrite, the first 90 seconds, NOT insert
90 seconds of silence to push the audio back 90 seconds).
-af "volume=enable='lte(t,90)':volume=0"
http://ffmpeg.org/ffmpeg-filters.html#volume
http://ffmpeg.org/ffmpeg-filters.html#Timeline-editing
(2)
Second, I want to produce a version of the video,
"OutputReplaced.avi", which would be identical to the original video
except that the first 90 seconds of the video's audio are replaced
with the first 90 seconds of "Audio.mp3" (again, to be clear, I want
to REPLACE, as in overwrite, the first 90 seconds, NOT insert 90
seconds of audio to push the original audio back 90 seconds).
How commands would I use to do this with FFmpeg? Ideally, I would like
to just remux without doing any re-encoding. Thanks in advance.
Only way I can think of is to use a combination of the volume filter above to suppress the audio form the video and chain it with 'amix' to create a new audio track.
If you run into volume level problems using 'amix' try a combination of 'amerge' to make it a 4 channel track then 'pan' to change it back into stereo.
http://ffmpeg.org/ffmpeg-filters.html#amix
http://ffmpeg.org/ffmpeg-filters.html#amerge-1
http://ffmpeg.org/ffmpeg-filters.html#pan
_______________________________________________
ffmpeg-user mailing list
ffmpeg-user at ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
step 1) Stop being a tool with the
all caps. be polite
You catch more flies with honey,
than you do with vinegar.
step 2)
grab just the audio from your video 90 seconds in:
ffmpeg -ss 00:01:30 -i in.mp4 -vn out.mp3
step 3)
concat your audio.mp3 with the out.mp3 you just made
ffmpeg -i "concat:audio.mp3|out.mp3" -c copy all.mp3
step 4)
take the video stream from the original video and mux in all.mp3
ffmpeg -i in.mp4 -i all.mp3 -map 0:0 -map 1:0 -c copy done.mp4
step 5) record a blank 90 secs of audio
and repeat the steps 3 and 4 with it instead of audio.mp3.
More information about the ffmpeg-user
mailing list