mltframework / shotcut

cross-platform (Qt), open-source (GPLv3) video editor
https://www.shotcut.org
GNU General Public License v3.0
11.08k stars 1.14k forks source link

Audio Desync Issues #424

Closed PazerOP closed 7 years ago

PazerOP commented 7 years ago

Significant audio desync issues when playing back this file. At 0:00, audio appears to be ~10 seconds ahead of where it should be, and audio ends ~10 seconds before the video ends. This is visible in the waveform. File works perfectly in any host of other media players including MPC-HC, VLC, WMP, and the Windows 10 Movies & TV app. Here's a link to a file that reproduces this issue.

OS Version: Windows 10 Pro 1703, Build 15063.138 Shotcut Version: 17.04.02

FFProbe:

ffprobe i_was_headshot_by_a_rocket.mp4
ffprobe version N-84814-gad7aff0 Copyright (c) 2007-2017 the FFmpeg developers
  built with gcc 6.3.0 (GCC)
  configuration: --enable-gpl --enable-version3 --enable-cuda --enable-cuvid --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-zlib
  libavutil      55. 52.100 / 55. 52.100
  libavcodec     57. 86.103 / 57. 86.103
  libavformat    57. 68.100 / 57. 68.100
  libavdevice    57.  3.101 / 57.  3.101
  libavfilter     6. 78.101 /  6. 78.101
  libswscale      4.  3.101 /  4.  3.101
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'i_was_headshot_by_a_rocket.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    date            : 2017
    encoder         : Lavf57.47.101
  Duration: 00:00:55.43, start: 34.581000, bitrate: 49967 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, smpte170m/smpte170m/bt470m), 2560x1440 [SAR 1:1 DAR 16:9], 49761 kb/s, 59.83 fps, 59.94 tbr, 60k tbn, 120 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 195 kb/s (default)
    Metadata:
      handler_name    : SoundHandler

MediaInfo:

General
Complete name                            : D:\dxtory\shadowplay\Team Fortress 2\cut\i_was_headshot_by_a_rocket.mp4
Format                                   : MPEG-4
Format profile                           : Base Media
Codec ID                                 : isom (isom/iso2/avc1/mp41)
File size                                : 330 MiB
Duration                                 : 55 s 426 ms
Overall bit rate                         : 50.0 Mb/s
Recorded date                            : 2017
Writing application                      : Lavf57.47.101

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L5.1
Format settings, CABAC                   : Yes
Format settings, ReFrames                : 1 frame
Format settings, GOP                     : M=1, N=30
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 55 s 424 ms
Bit rate                                 : 49.8 Mb/s
Width                                    : 2 560 pixels
Height                                   : 1 440 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Variable
Frame rate                               : 59.830 FPS
Minimum frame rate                       : 56.872 FPS
Maximum frame rate                       : 62.893 FPS
Original frame rate                      : 60.000 FPS
Standard                                 : PAL
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.226
Stream size                              : 329 MiB (100%)
Color range                              : Limited
Color primaries                          : BT.601 NTSC
Transfer characteristics                 : BT.470 System M
Matrix coefficients                      : BT.601

Audio
ID                                       : 2
Format                                   : AAC
Format/Info                              : Advanced Audio Codec
Format profile                           : LC
Codec ID                                 : 40
Duration                                 : 55 s 426 ms
Bit rate mode                            : Constant
Bit rate                                 : 192 kb/s
Channel(s)                               : 2 channels
Channel positions                        : Front: L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 spf)
Compression mode                         : Lossy
Stream size                              : 1.29 MiB (0%)
Default                                  : Yes
Alternate group                          : 1
ddennedy commented 7 years ago

Variable frame rate is not supported. You need to convert it to edit it. This is a typical problem for video editing software. Unfortunately, we do not have a good way yet to determine if a file is variable frame rate to warn the user.

PazerOP commented 7 years ago

Are there any plans to support this going forward? I don't want to introduce additional quality loss/conversion work into my workflow. Like I said, every video player I've seen is able to play back these files no problem. Is there a reason that there are so few video editors that properly support VFR?

ddennedy commented 7 years ago

No plans at the moment. You can change the capture tool to use constant frame rate, but AFAIK Shadowplay does not support it, but OBS does. If you are going to convert it, you can convert it to something lossless or visually lossless that is also faster and more reliable than H.264 for editing anyways.