Annoying time offsets when using proxies

What is your operating system?
Ubuntu Linux, 23.10

What is your Shotcut version (see Help > About Shotcut)?
23.06.14 but this has been ailing me time and again over years.

Can you repeat the problem? If so, what are the steps?
I don’t know a good recipe to repeat; it always happens.

I am using proxies for videos at 1920x1280@50p (also the project video mode). After significant editing and exporting, audio tends to be off significantly, often lagging a few hundreds of milliseconds.

My guess is that the proxy works with a lower frame rate than the original video and that the time code calculations end up being off at some point of time due to not properly converting (converting twice or not at all) the proxy timecodes when creating the export batch files.

Proxies are generated in the same frame rate as the source - except when the source has variable frame rate. You said the problem appears in the Export result, but the export normally does not use the proxies. Thus, likely the problem occurs regardless of whether proxy is used. To confirm, turn off proxy, open a project where you had the problem, export, and check it. Maybe the problem is the source is variable frame rate. Or maybe there is some sync problem with the source that the proxies mask.

Ok, I’ve checked the proxies and they are also 50fps.

However, unchecking “use proxies” leads to a “Conversion” popup taking a while. Afterwards, the audio waveforms still appear to be in sync. However, doing “regenerate waveform” then leads to the appearance being shifted.

So even if the proxies have the same frame rate, going to proxies and back results in some shift under the covers.

The time codes also appear to run from 0 to 49. So on the surface, this looks like it may not be frame-rate related after all.

Ok. But the offset is there, it tends to end up in the 200ms-300ms ballpark, and I have no idea how it crops up. Regenerating waveforms and stuff appears to only help after switching proxies off.

The source files are AVCHD files with the .MTS extension, from a STREAMS subfolder in the original file hierarchy. Shotcut is fine with showing them, VLC is fine with showing them, but I think I had problems with ffmpeg at some time. One theory would be that MELT would be uncomfortable seeking in them, but that cannot be it because switching off proxies makes a difference.

So it would appear that the instructions given to Melt when exporting are worse when working from proxies than when working from the original.

I have problems making sense from all this. Maybe it is related to some problems working with the MTS files that does not surface when both Melt and Shotcut are working from them?

MTS = MPEG2 Transport Stream

It’s a stream format designed for satellite, terrestrial and cable transmission captured as a file. It has no file header and the metadata and timing information is constantly repeated (as a user can switch to a transport stream at any point in its transmission).

You may be better off using FFmpeg or one of it’s GUIs to copy the video and audio to an MP4 file.

Yes. This is probably the problem due to poor seeking with transport stream files. Unfortunately, for these files, your workflow should probably be:

  1. Open the file in Shotcut
  2. Convert the file to edit friendly
  3. Turn on proxy after all files are converted

As @st599 mentioned, you might be able to replace step #2 with an FFMpeg comment to repackage the MTS file streams.

1 Like