On Mon, 25 Mar 2024 01:47:27 +0100, Paul B Mahol <one...@gmail.com> wrote:
>On Mon, Mar 25, 2024 at 12:54?AM Laine Lee <llee...@sbcglobal.net> wrote: > >> >> >> > On Mar 24, 2024, at 5:31?PM, Bo Berglund <bo.bergl...@gmail.com> wrote: >> > >> > ?I know how to use ffmpeg to adjust the video/audio sync and that is a >> real >> > simple command not requiring any remuxing or such. This is what I use in >> my >> > audiosync script and it runs very fast: >> > >> > ffmpeg -i $SOURCEFILE -itsoffset $DELAY -i $SOURCEFILE -map 1:v -map 0:a >> -c copy >> > $TARGETFILE >> > >> > >> > But is it possible also to modify an mp4 video file to *play* >> faster/slower than >> > original while keeping the accompanying audio pitch the same? >> > >> > It *can* be done for instance in the VLC video player on playback, but >> can one >> > also modify the video file itself using ffmpeg so it will play at the >> new speed >> > while keeping audio recognizable (not Donald Duckie)? >> > >> > If so how is it done? >> > >> > >> > -- >> >> Sounds to me as though you want to change tempo of the audio stream. I >> believe theres a pipe from ffmpeg to Sox to handle it, but for that you >> will extract audio, apply the tempo change, then remux. Changing tempo by a >> factor greater than one reduces duration, and by a factor less than one >> increases duration. >> > >FFmpeg have tempo audio filter called atempo. No need to use obsolete SoX. > > Thanks a bunch! I found the syntax as an example at http://trac.ffmpeg.org/wiki/How%20to%20speed%20up%20/%20slow%20down%20a%20video so I made a test. Note: Newsreader is doing the line wrap, it is on a single line of course: ffmpeg -hide_banner -i input.mp4 -filter_complex "[0:v]setpts=0.5*PTS[v];[0:a]atempo=2.0[a]" -map "[v]" -map "[a]" output.mp4 It took 6 s to encode a 76 s mp4 video into a 38 s sped up video. So it seems like one must apply the inverse factor on setpts and atempo, i.e. change audio tempo by the inverse of the video speed. I tested it with speedups of 2.0 and 1.25 and both worked OK. So I will package this into a speedchange script among the other video utilities scripts I have created. -- Bo Berglund Developer in Sweden _______________________________________________ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".