[FFmpeg-user] CUTTING A VIDEO WITHOUT RE-ENCODING GETS AUDIO OUT OF SYNC
Erik Dobák
erik.dobak at gmail.com
Sun Sep 1 10:33:10 EEST 2019
On Sun, 1 Sep 2019 at 01:04, Micael Silva <micaelsilva at gmail.com> wrote:
> On Thu, Aug 29, 2019 at 6:41 PM Alejandro Escudero <
> escuderoserrano at hotmail.com> wrote:
>
> > Hi!
> >
> > I am trying to cut a video file in to parts, without re-enconding the
> > video, but i get a video file with non sync audio, how can I solve these
> > with out re-encoding since I need a fast way to cut.
> >
> > I used this command:
> >
> >
> > ffmpeg -i file.mp4 -ss 00:03:00 -t 00:05:00 -c copy part1.mp4
> >
> > Thanks!
> >
> >
> > Alejandro
> >
>
> By my own experience I found that it usually happens because the cut falls
> somewhat distant of the next keyframe of the video. The player tries to
> play the video track but have to wait until the next keyframe but the audio
> start to play immediately, resulting in loss of sync.
>
> Try to cut closeset to the keyframe. Unfortunally I had no recipe for that,
> I fixed my cases on the try-and-error method.
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
to get the times of the keyframes you can use this command:
ffprobe -show_frames <video_file_name.avi>|grep -B 14 pict_type=I|grep
pkt_pts_time=|awk -F'=' '{print $2}'|xargs -I{} date -d@"{}" -u
+%H:%M:%S.%N
E
More information about the ffmpeg-user
mailing list