2

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.

2
  • What do you want to do, exactly? Your question title makes me think you want to do this to your video, but your question content makes me think you want to mute a segment of your audio.
    – llogan
    Jun 20, 2014 at 17:48
  • Part of recorded audio contains sensitive information. I want to remove that information while keeping the video and rest of the audio intact. I'll put this into the question itself as well.
    – sumek
    Jun 21, 2014 at 21:11

2 Answers 2

2

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

https://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.

1

Based on @dstob's answer, I noticed that nobody had suggested any code. Here's what I did1:

ffmpeg -i in.mkv -c copy -t 00:01:30 seg1.mkv # segment the clip at time=90 seconds
ffmpeg -i in.mkv -c copy -ss 00:01:30 seg2.mkv # obtain the remainder of the clip
ffmpeg -i seg1.mkv -i in.wav -c copy -map 0:v:0 -map 1:a:0 new-seg.mkv # replace audio from the first 90 seconds of the original clip using in.wav
ffmpeg -i new-seg.mkv -i seg2.mkv -filter_complex "concat=n=2:v=1:a=1" -vn final-out.mkv # concatenate them back together; v=1 and a=1 are telling ffmpeg that both files have video and audio; n=2 tells ffmpeg that you are concatenating two files
# rm seg1.mkv seg2.mkv new-seg.mkv # clean up

1 Note that I tried to do minimum re-encoding and options (to make it as general as possible for people's ease of use). One will have to follow the links provided by @dstob to find out more about flags/options.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .