Shotcut changes length of video


#1

Hello,

I am not sure whether this is a bug or some behavuiour I don’t understand, but I have the problem that shotcut is modifying the length of video and audio slightly when I import a file.

So I demux a video file, do some audio editing (not in length) and mux (and cut etc.) the files again with shotcut. But everytime I have a small delay in audio an video (about 20-40ms), which have to correct manually. On investigating where this problem comes from, I had a look at the video and audio length and noticed that they differ between the original file and what shotcut shows me.

So here is an example without demuxing and muxing to exclude the risk that something is messed up during demuxing or muxing: I have a video file and I get the length with ffprobe.exe, it is 0:27:08.75. When I import the file in shotcut it shows in the playlist window: 0:27:08:45…

The ffmprobe command I used were:

ffprobe.exe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 -sexagesimal 20180909_213616.MOV
or
ffprobe.exe -v error -select_streams v:0 -show_entries stream=duration -of default=noprint_wrappers=1:nokey=1 -sexagesimal 20180909_213616.MOV
according to http://trac.ffmpeg.org/wiki/FFprobeTips

Any comments on this?

Thanks
Matthias


#2

The ffprobe time output is in HH:MM:SS where the last field is seconds. Shotcut is HH:MM:SS:FF where the last field is frames. I am sure they are the same based on the frame rate. Shotcut uses FFmpeg and computes the length using FFmpeg in the same manner. If you really doubt me, you can look at the code yourself:


#3

look at this: 45 frames / 60 frames/second = .75 second


#4

Ok, thanks for clarification, then I have to search another explanation for my delay…


#5

How are you measuring this small delay?


#6

Ah sorry, I didn’t notice your question, but I can answer this now.

I am recording videos of computer games and there are scenes where you see visuals accompanied strict with sounds e.g. clicking through menues etc. And there I can see that the action stopps but the sound is coming later for that action… And then I have to move the video track about 10 frames forward to get it in sync again.


#7

I have still not found a solution to this problem, but I still have the feeling shotcut is somehow involved in it. When I import the original file in shotcut I can see the sound is a little bit delayed. When I just play the file with VLC player the sound is ok. I downloaded also a trial version of Vegas Movie Studio and there it is also ok. If you want I can send you a demo file, but I have to cut something and see if the problem still occurs on a cut video, because I don’t want to upload 8GB. :slight_smile:


#8

What is the source file(s) specifications?
What is your Video Mode set at? (Settings/Video Mode)
Is GPU Effects (experimental) turned on? Make sure this is off.


#9

If you record video games, are you converting them to a constant frame rate first before working on them in Shotcut? When I record gameplay, I use Handbreak to convert to a constant 60 FPS, otherwise I had out-off-sync issues too. Though Shotcut should complain if you drop variable frame rate videos into it.


#10

Not sure what you record with, but why not just record at 60FPS?
I’ve been recording at 60FPS for a year with OBS (MP4 video)
(Image is from OBS)
obs64_2018-11-03_03-55-35

I’ve had audio sync issues before, but it wasn’t Shotcut. My weird theory is when NVIDIA updates, it doesn’t play well with Realtek audio drivers. Twice I’ve had to uninstall and reinstall my audio drivers to correct the issue. The source files had the sync issues. Took me two months to solve this issue. Just Google “video desync”, and you’ll see hundreds if not thousands of forum posts in every software dealing with video.


#11

I record with the Geforce Experience overlay. It has an option to record at either 30 or 60 FPS, but these files are still variable frame rate. That’s even the case if my hardware is powerful enough to actually run the game at a constant 60 FPS (in some games I’m getting more like 40 in-game). I might try out OBS if that saves the conversion step, thank you :slight_smile:


#12

OBS is far superior to recording options than Geforce Experience. There is a ton of settings you can set for the best recording. I do suggest looking at “EposVox” on YouTube for his master course on OBS for learning how the settings work. And run test after test until you have it the way you want it. It took me about 5 test trials before I found what I was happy with.


#13

Thx :slight_smile: I’ll check out his videos!


#14

The UI for OBS isn’t exactly pretty, but it’s one very powerful piece of software, and it’s also FOSS (Free Open Source Software). I haven’t even explored all of what OBS can do.


#15

The next version has an A/V sync fix for some files, particularly ones from capture sources, and that might resolve this audio delay problem you are experiencing it. Try with v18.11 coming soon.


#16

I tested the beta of version 18.11 and the problem is not solved for my file.

To answer hudson555x questions:
Source spec:
General
Complete name : E:\Lets Play\SpiderMan\2 Edited\05-06\05-06.MOV
Format : MPEG-4
Format profile : QuickTime
Codec ID : qt 0000.02 (qt )
File size : 7.98 GiB
Duration : 1 h 13 min
Overall bit rate : 15.6 Mb/s
Writing application : Lavf58.12.100

Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L4
Format settings : 2 Ref Frames
Format settings, CABAC : No
Format settings, RefFrames : 2 frames
Format settings, GOP : M=3, N=15
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 1 h 13 min
Bit rate : 15.4 Mb/s
Width : 1 920 pixels
Height : 1 080 pixels
Display aspect ratio : 16:9
Frame rate mode : Constant
Frame rate : 59.940 (60000/1001) FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.124
Stream size : 7.91 GiB (99%)
Language : English
Codec configuration box : avcC

Audio
ID : 2
Format : AAC LC
Format/Info : Advanced Audio Codec Low Complexity
Codec ID : mp4a-40-2
Duration : 1 h 13 min
Bit rate mode : Constant
Bit rate : 128 kb/s
Channel(s) : 2 channels
Channel layout : L R
Sampling rate : 48.0 kHz
Frame rate : 46.875 FPS (1024 SPF)
Compression mode : Lossy
Stream size : 67.1 MiB (1%)
Language : English
Default : Yes
Alternate group : 1

Video Mode is set to auto, so timeline has 59,401 FPS on properties.

GPU effects is not turned on.


#17

I do not plan to do anything about this. You can use the a/v sync slider in Properties > Audio or submit a patch.


#18

Sorry, my C skills are too bad to get this done. :wink: Thanks anyway.