[FFmpeg-user] Cutting on video frame
Louis Letourneau
lletourn49 at gmail.com
Thu Jul 7 21:05:37 EEST 2016
>
> > When cutting a video, even when transcoding, I often have a small delay
> > between the video and audio.
>
> After many problems, I started converting my audio to uncompressed
> PCM to do cutting, then re-encoding it later (of course this works
> for me because I only have stereo audio :-).
I just tried, converting audio for cutting works fine:
ffmpeg -y -ss 0.042000 -i 2708-1.mp4 -codec:a pcm_s32le -codec:v libx264
-crf 23 -preset fast -pix_fmt yuv420p -flags +global_header
-force_key_frames "expr:gte(t,n_forced*5)" -bf 0 a.mp4
[FRAME]
media_type=audio
pkt_pts=0
[/FRAME]
...
[FRAME]
media_type=video
pkt_pts=0
[/FRAME]
Converting it back to aac, just pads it with negative pts again (as the
trac ticket explains)
ffmpeg -y -i a.mov -codec:a libfdk_aac -b:a 128k -codec:v copy -flags
+global_header a.mp4
[FRAME]
media_type=audio
pkt_pts=-2048
[/FRAME]
[FRAME]
media_type=audio
pkt_pts=-1024
[/FRAME]
[FRAME]
media_type=audio
pkt_pts=0
[/FRAME]
...
[FRAME]
media_type=video
pkt_pts=0
[/FRAME]
Louis
More information about the ffmpeg-user
mailing list