How to replace part of audio in a video using the command line?
2014-07
Part of a recorded audio contains sensitive information. I want to remove that information while keeping the video and rest of the audio intact. Ideally using command line and being able to exactly specify the beginning and end.
Segment, replace audio of portion that you want, concat the pieces back together.
https://www.ffmpeg.org/ffmpeg-formats.html#segment_002c-stream_005fsegment_002c-ssegment
http://stackoverflow.com/questions/12368151/adding-silent-audio-to-mov-in-ffmpeg
https://trac.ffmpeg.org/wiki/How%20to%20concatenate%20(join,%20merge)%20media%20files
I do not know if this will provide a flawless execution but it is how I would solve your problem.
I have a divx video of 10 mins. I want to copy two parts from it , minutes 2 to 6 and 8 to 10 and create another video by merging the two. how can I do it using lightweight command line tools. Either on Windows or Linux?
Perhaps ffmpeg/mencoder (available on either platform).
To split:
ffmpeg -ss [start_seconds] -i [input_file] -t [duration_seconds] [outputfile]
For example:
ffmpeg -ss 2 -i input.avi -c copy -t 4 video1.avi
ffmpeg -ss 8 -i input.avi -c copy -t 2 video2.avi
To merge:
mencoder -ovc copy -oac copy video1.avi video2.avi -o output.avi
If your video/audio is out of synchronization, you might need to re-encode them, e.g. with XviD for an AVI container, and MP3 audio:
ffmpeg -ss 2 -i input.avi -c:v libxvid -qscale:v 3 -c:a libmp3lame -q:a 3 -t 2 output.avi
Change the qscale
parameter to a lower value for higher quality, and the same for q:a
for the audio parts.
To split the video there's a hand command line tool called jumptheshark.