[FFmpeg-user] Combining 24fps Video with 23.976fps Audio

Sam Logan shapableline at gmail.com
Sat Sep 21 04:14:28 CEST 2013


On 9/20/13, Carl Eugen Hoyos <cehoyos at ag.or.at> wrote:
> Sam Logan <shapableline <at> gmail.com> writes:
>
>> ffmpeg -i "Video1.mp4" -i "Video2.mp4" -acodec copy
>> -vcodec copy -map 0:0 -map 1:1 -map 0:1 "Output.mkv"
>
> I don't see how you can change the speed of audio with
> -codec copy, so below applies to reencoding.
> -r 24 / -r 24000/1001 might allow to change the video
> speed even with -vcodec copy.

I tried -r first as an input option and then as an output option. In
both cases, it had no effect on the generated video, which remained
out of sync in one audio stream.

>> Which works fine until I play the resulting video,
>> whereupon I realized that I overlooked that Video1
>> had a framerate of 24 fps, whereas Video2 has a framerate
>> of 23.976 fps
>
> The atempo and the setpts filter should allow you to change
> the speed of the files:
> http://ffmpeg.org/ffmpeg-filters.html#setpts_002c-asetpts
> http://ffmpeg.org/ffmpeg-filters.html#atempo

How do I apply these filters to just the audio stream of Video2 but
not the streams of Video1? If I use -af as an output option by putting
it before the output file parameter, then the filter will get applied
to all input streams, right? And if I specify -af as an input option
by putting it before one of the input file parameters, then FFmpeg
won't work, giving me this error message:

Option af (set audio filters) cannot be applied to input file
Video2.mp4 -- you are trying to apply an input option to an output
file or vice versa. Move this option before the file it belongs to.


More information about the ffmpeg-user mailing list