[FFmpeg-user] Automatically crop longer file when merging

Bouke (VideoToolShed) bouke at videotoolshed.com
Thu Jan 23 10:32:15 CET 2014


 ----- 
From: "Ramit Bhalla" <ramitbhalla at gmail.com>
To: "FFmpeg user questions" <ffmpeg-user at ffmpeg.org>
Sent: Thursday, January 23, 2014 7:47 AM
Subject: Re: [FFmpeg-user] Automatically crop longer file when merging


> You can tell ffmpeg to use only part of the audio input file like:
>
> ffmpeg -i video -i audio -t <x> ....
>
> the x would be 1 second less than the length of the video in seconds, this
> will take the first x seconds (or you can skip 1 second initially by using
> -ss 1 instead of -t <x>)
>

l
or easier, if the sources start at the same time, just add -shortest
(then the encoding will stop at the first file end it encounters.
hth,
Bouke

> On Wed, Jan 22, 2014 at 5:23 AM, Samir <joeindien at gmail.com> wrote:
>
>> Hello,
>>
>> I have recorded separatly two files for the same sequence: an mp4 file 
>> for
>> the video part and a wav for the audio part. I can mix them easily with
>> ffmpeg.
>>
>> My problem is that the audio file is longer than the video file, about 1
>> second only but it produces an out of sync video...
>>
>> I know I can crop my audio file but I need first to get the duration for
>> my files to known how many time i need to cut.
>>
>> Is there a way to tell ffmpeg to automatically crop the audio file to fit
>> the duration of my video file?
>> _______________________________________________
>> ffmpeg-user mailing list
>> ffmpeg-user at ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>>
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user 



More information about the ffmpeg-user mailing list