Replacing a segment of audio

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Replacing a segment of audio

Steve Bick
I'm trying to replace just a segment of audio in an existing video with
another piece of audio.

 

Goal: I have a video w/ audio, and want to replace just the audio in a
middle segment of the video without affecting the rest of the video and
audio.

 

The closest I've come is using this:

 

-----

ffmpeg.exe -y -i  "Video.mp4" -i "AudioToReplace.mp3" -filter_complex
"[0:a]atrim=0:316,asetpts=PTS-STARTPTS[aud1];[1:a]atrim=0:172,asetpts=PTS-ST
ARTPTS[aud2]"  -map 0:v -map "[aout]" -c:v copy -c:a libmp3lame New.mp4

-----

 

It results in the audio being replaced in the beginning of the video and the
rest of the audio shifted.

 

I'm having a difficult time understanding what the 'filter_complex' and
'map' parameters are doing but I think I'm getting close. Can someone please
explain these and help me adjust my command above in order to achieve my
goal?

 

Thanks!

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Replacing a segment of audio

Paul B Mahol
On 10/22/18, Steve Bick <[hidden email]> wrote:

> I'm trying to replace just a segment of audio in an existing video with
> another piece of audio.
>
>
>
> Goal: I have a video w/ audio, and want to replace just the audio in a
> middle segment of the video without affecting the rest of the video and
> audio.
>
>
>
> The closest I've come is using this:
>
>
>
> -----
>
> ffmpeg.exe -y -i  "Video.mp4" -i "AudioToReplace.mp3" -filter_complex
> "[0:a]atrim=0:316,asetpts=PTS-STARTPTS[aud1];[1:a]atrim=0:172,asetpts=PTS-ST
> ARTPTS[aud2]"  -map 0:v -map "[aout]" -c:v copy -c:a libmp3lame New.mp4
>
> -----
>
>
>
> It results in the audio being replaced in the beginning of the video and the
> rest of the audio shifted.
>
>
>
> I'm having a difficult time understanding what the 'filter_complex' and
> 'map' parameters are doing but I think I'm getting close. Can someone please
> explain these and help me adjust my command above in order to achieve my
> goal?

Currently there is no easy way to do it. Best way is using trim &
concat filter/demuxer
on audio stream.
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".