Opened 7 years ago

Last modified 7 years ago

#6114 new defect

Vsync behaviour when used along with -ss

Reported by: Mlmlte Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords: vsync
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:

To encode some TV transport streams in x264 for archiving purposes, I've been using -vsync 1 so that the resulting mkv file gets muxed without delay on any of the two tracks (audio/video), which is fundamental since I am then able to cut my encodes on key frames without re-encoding, and everything plays fine on all of my devices.

Without the -vsync 1 option, I get a random negative delay on the audio, as mediainfo shows (e.g. Delay relative to video: -1s 105ms) and if I then try to cut my encode, the audio is out of sync.

When I use the -ss parameter to avoid encoding the whole transport stream file, it seems that the -vsync 1 does not have the same behavior since I get a similar negative delay on the audio track.

However, dupe frames are indeed inserted at the beginning of the encode, so I'm not sure exactly what happens here.

Is it a bug? Any way to get file with zero delay when using -ss parameter?

In this case, the original file is a h264 transport stream with AC3 audio with -668ms delay.

How to reproduce:

ffmpeg.exe -ss 00:13:40 -i source.ts -vf -s 1280x720 -sws_flags lanczos -c:v libx264 -crf 20 -preset fast -c:a copy -sn -vsync 1 output.mkv

-> Negative delay

ffmpeg.exe -i source.ts -vf -s 1280x720 -sws_flags lanczos -c:v libx264 -crf 20 -preset fast -c:a copy -sn -vsync 1 output.mkv

-> No delay

ffmpeg.exe -i source.ts -vf -s 1280x720 -sws_flags lanczos -c:v libx264 -crf 20 -preset fast -c:a copy -sn output.mkv

-> Negative delay

ffmpeg version N-83280-gcba4f0e (latest zeranoe build)

Thanks a lot!

Change History (2)

comment:1 by Carl Eugen Hoyos, 7 years ago

Do you want to report a bug?
If yes, please provide the command line that allows to reproduce the issue together with the complete, uncut console output.

Why is a negative delay an issue?

comment:2 by Mlmlte, 7 years ago

I am not sure whether it's a bug or not, I thought -vsync 1 behaviour was to sync audio with video by inserting/droppingv video frames. Am I wrong?

A negative delay is an issue since when I try to cut my encode on key-frames with ffmpeg the audio gets out of sync, unfortunately.

Thanks for the quick response, I can provide full command line output if you like.

Note: See TracTickets for help on using tickets.