I mean, I read that Megui is based only on Avisynth and that Avisynth doesn't support VFR (as resulting video encoded). I know MediaCoder and VidCoder can encode to Variable Frame Rate, my problem is that those programs doesn't have an option like MeGui has to cut parts of the video (AVS Cutter), the other programs only have and initial and ending time, but that's useless for me. I need a program to (multiple) cut commercials from the video. I read that you can import a timecodes from a file and adding to the resulting video later, but in my case this isn't useful because my resulting video has lot of cuts/trim comparing to the original (commercial cut).
So I just need a similar program like Megui but that can support or properly convert VFR to CFR w or VFR to VFR but without desync. I didn't find any software that can do this and I have lot of VFR videos and I'm tired of the a/v desync. Thanks.
+ Reply to Thread
Results 1 to 11 of 11
-
Anonymous847344Guest
Last edited by Anonymous847344; 8th Jun 2020 at 01:52.
-
1) You can convert to CFR in the script, then do the edit/trims in the script or megui
or
2) You can try vfr.py if you want to keep VFR . It runs on python, commandline. There is a macro for avspmod, and apparently there is a GUI for it somewhere
https://forum.doom9.org/showthread.php?t=154535 -
Anonymous847344Guest
About the first do you mean this?:
LoadPlugin("C:\Megui\tools\lsmash\LSMASHSource.dll ")
LSMASHVideoSource("E:\Grabaciones\laptop\RECentral \RG2017.mp4")
#deinterlace
#crop
LanczosResize(1280,720) # Lanczos (Sharp)
#denoise
#ConvertToYV12(matrix="pc.709")
__film = last
__t0 = __film.trim(59132, 148908)
__t1 = __film.trim(154306, 181392)
__t2 = __film.trim(186187, 201182)
__t3 = __film.trim(204659, 255266)
__t4 = __film.trim(258865, 286754)
__t5 = __film.trim(290349, 321807)
__t6 = __film.trim(325402, 374282)
__t7 = __film.trim(377882, 435547)
__t8 = __film.trim(439148, 473550)
__t9 = __film.trim(476727, 570604)
__t10 = __film.trim(574199, 577916)
__t11 = __film.trim(581512, 598763)
__t0 ++ __t1 ++ __t2 ++ __t3 ++ __t4 ++ __t5 ++ __t6 ++ __t7 ++ __t8 ++ __t9 ++ __t10 ++ __t11
LoadPlugin("C:\Megui\tools\avs\plugins\DirectShowS ource.dll")
#DirectShowSource()
LoadPlugin("C:\Megui\tools\avs\plugins\directshows ource.dll")
DirectShowSource("RG2004_DTV.mkv", fps=59.853, audio=false, convertfps=true)
ConvertBits(8)
#deinterlace
#resize
#denoise
#ConvertToYV12(matrix="pc.709")
crop(168, 0, -168, 0)
__film = last
__t0 = __film.trim(194899, 208204)
__t1 = __film.trim(211796, 282861)
__t2 = __film.trim(286452, 323034)
__t3 = __film.trim(326624, 335705)
__t4 = __film.trim(338995, 377269)
__t5 = __film.trim(380863, 411778)
__t6 = __film.trim(415372, 440324)
__t7 = __film.trim(443924, 466266)
__t8 = __film.trim(469858, 523560)
__t9 = __film.trim(527151, 561950)
__t10 = __film.trim(565542, 599188)
__t11 = __film.trim(602787, 640098)
__t12 = __film.trim(643691, 652811)
__t13 = __film.trim(656401, 719017)
__t14 = __film.trim(726204, 743492)
__t15 = __film.trim(745290, 800610)
__t16 = __film.trim(802409, 817043)
__t17 = __film.trim(818837, 839387)
__t18 = __film.trim(844782, 869815)
__t19 = __film.trim(875811, 920331)
__t20 = __film.trim(927511, 970834)
__t21 = __film.trim(974428, 993031)
__t22 = __film.trim(1000032, 1056643)
__t0 ++ __t1 ++ __t2 ++ __t3 ++ __t4 ++ __t5 ++ __t6 ++ __t7 ++ __t8 ++ __t9 ++ __t10 ++ __t11 ++ __t12 ++ __t13 ++ __t14 ++ __t15 ++ __t16 ++ __t17 ++ __t18 ++ __t19 ++ __t20 ++ __t21 ++ __t22
Original mediainfo file:
General
Complete name : E:\Grabaciones\RECentral\RG2004_DTV.mp4
Format : MPEG-4
Format profile : Base Media / Version 2
Codec ID : mp42 (mp42/isom)
File size : 33.9 GiB
Duration : 8 h 21 min
Overall bit rate : 9 684 kb/s
Encoded date : UTC 2020-06-04 12:06:01
Tagged date : UTC 2020-06-04 12:06:01
Video
ID : 2
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L4
Format settings : 1 Ref Frames
Format settings, CABAC : No
Format settings, Reference : 1 frame
Format settings, GOP : M=1, N=15
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 8 h 21 min
Source duration : 8 h 21 min
Bit rate : 9 485 kb/s
Width : 1 280 pixels
Height : 720 pixels
Display aspect ratio : 16:9
Frame rate mode : Variable
Frame rate : 59.853 FPS
Minimum frame rate : 0.655 FPS
Maximum frame rate : 59.940 FPS
Original 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.172
Stream size : 33.2 GiB (98%)
Source stream size : 33.2 GiB (98%)
Language : English
Encoded date : UTC 2020-06-04 12:06:01
Tagged date : UTC 2020-06-04 12:06:01
mdhd_Duration : 30098294
Codec configuration box : avcC
Audio
ID : 1
Format : AAC LC
Format/Info : Advanced Audio Codec Low Complexity
Codec ID : mp4a-40-2
Duration : 8 h 21 min
Source duration : 8 h 21 min
Bit rate mode : Constant
Nominal bit rate : 96.0 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
Source stream size : 700 MiB (2%)
Language : English
Encoded date : UTC 2020-06-04 12:06:01
Tagged date : UTC 2020-06-04 12:06:01
mdhd_Duration : 30098192
General
Complete name : E:\Grabaciones\RECentral\RG2004_DTV.mp4.mp4
Format : MPEG-4
Format profile : Base Media
Codec ID : isom (isom/avc1)
File size : 5.35 GiB
Duration : 3 h 35 min
Overall bit rate : 3 559 kb/s
Encoded date : UTC 2020-06-06 23:03:43
Tagged date : UTC 2020-06-06 23:03:43
Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L4
Format settings : CABAC / 8 Ref Frames
Format settings, CABAC : Yes
Format settings, Reference : 8 frames
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 3 h 35 min
Bit rate : 3 554 kb/s
Maximum bit rate : 8 549 kb/s
Width : 944 pixels
Height : 720 pixels
Display aspect ratio : 4:3
Frame rate mode : Constant
Frame rate : 59.853 FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.087
Stream size : 5.34 GiB (100%)
Writing library : x264 core 157 r2969 d4099dd
Encoding settings : cabac=1 / ref=8 / deblock=1:0:0 / analyse=0x3:0x133 / me=umh / subme=9 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=22 / lookahead_threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=599 / keyint_min=59 / scenecut=40 / intra_refresh=0 / rc_lookahead=60 / rc=crf / mbtree=1 / crf=20.5 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00
Encoded date : UTC 2020-06-06 23:03:43
Tagged date : UTC 2020-06-06 23:07:02
Codec configuration box : avcCLast edited by Anonymous847344; 8th Jun 2020 at 01:55.
-
Try converting to a constant frame rate before adding the Trims. I wouldn't use DirectShowSource for that. Convert it with lsmash instead:
LSMASHVideoSource("E:\Grabaciones\laptop\RECentral \RG2017.mp4", FPSNum=60000, FPSDen=1001)
If for some reason LSMASHVideoSource has problems (the picture is jittery in places) you can do the same thing with LWLibavVideoSource. In fact I'd try LWLibavVideoSource first as it indexes the video so it should be 100% frame accurate (that's not always the case for LSMASHVideoSource).
LWLibavVideoSource("E:\Grabaciones\laptop\RECentra l \RG2017.mp4", FPSNum=60000, FPSDen=1001)
You can do the same thing with ffms2.
FFVideoSource("E:\Grabaciones\laptop\RECentral \RG2017.mp4", FPSNum=60000, FPSDen=1001)
Convert the source to 59.94fps (60000/1001) because MediaInfo says that's the maximum frame rate, so converting to a CFR should only add frames, not drop them. Plus it's also a standard frame rate.
How are you cutting the audio to match? With a cuts file? If you convert to a constant frame rate before adding the trims to the script, it should work fine. A cuts file looks like this if you open it with Notepad, and as you can see, it works based on the frame numbers used for the Trims, and MeGUI converts them to times for cutting the audio based on the frame rate, so you can't change the frame rate of the script after adding the trims.
Code:<?xml version="1.0"?> <Cuts xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Framerate>23.976023976023978</Framerate> <Style>NO_TRANSITION</Style> <AllCuts> <CutSection> <startFrame>9250</startFrame> <endFrame>13406</endFrame> </CutSection> <CutSection> <startFrame>16088</startFrame> <endFrame>18635</endFrame> </CutSection> <CutSection> <startFrame>20825</startFrame> <endFrame>23148</endFrame> </CutSection> </AllCuts> </Cuts>
Last edited by hello_hello; 8th Jun 2020 at 05:30.
Avisynth functions Resize8 Mod - Audio Speed/Meter/Wave - FixBlend.zip - Position.zip
Avisynth/VapourSynth functions CropResize - FrostyBorders - CPreview (Cropping Preview) -
Anonymous847344Guest
Thanks. So basically for these complicated VFR cases I need to re-encode 2 times, 1 to a lossless to pass from VFR to CFR, and the other encoding over the resulting VFR to CFR video, right? Then do the trim and add the .clt to the audio from there.
I read that Avermedia chose VFR over CFR for recordings. I'll be considering elgato for the next time. -
You'd do it all in one go. No need to encode the video twice. Create the script, add the stuff to convert to a CFR, save it, open it with the AVS cutter and when you've added the trims, re-encode the audio and video.
If MediaInfo is correct about the average frame rate being 59.853 fps, then most of it is probably 59.94 fps with a section or two at a lower frame rate.
When you create the script with the script creator, add the frame rate stuff and refresh the preview. The total number of frames should increase a little, but the duration shouldn't change. If you're not seeing times as well as frame numbers at the top of the script creator's preview, enable "add time position" under Options/Extended.
If you index with ffms2, MeGUI will automatically add the frame rate stuff, but it almost never adds the correct frame rate for a VFR source. You'd want to change it to the following for your source:
FPSNum=60000, FPSDen=1001Last edited by hello_hello; 8th Jun 2020 at 06:41.
Avisynth functions Resize8 Mod - Audio Speed/Meter/Wave - FixBlend.zip - Position.zip
Avisynth/VapourSynth functions CropResize - FrostyBorders - CPreview (Cropping Preview) -
You can try cutting the source in avidemux and remixing it then do your vfr to cfr stuff in megui. That way your not rencoding twice and can see if the new source is in sync. I do this with my OTA captures and with playon captures. Pick copy for the audio and video codecs and mkv as the output container. as always mileage may vary.
if all else fails read the manual -
Anonymous847344Guest
MAN, it worked!! Thank you so much. Audio and video perfectly synced. Even with cuts they are synced.
Yeah, I tried that, the problem is that kind of trims are based on keyframes so the trims aren't exactly where I want. The last time what I did is to cut by keyframes as you said, then re-encode the video based on that generated file (without re-encode) and trim precisely with AVS Cutter from Megui. Of course this I did after adding the lines to the script that "hello_hello" gave me. I did this before but without those lines he provided me the out of sync was present. So that did the trick.
I will test with another video I have with the same problem, but seems clear that this was the issue. Many thanks. -
You're welcome, but just so you know, only add the frame rate stuff for a VFR source, or if for some reason you want to change the frame rate of a CFR source (although there's probably better ways to do that). If you add the frame rate stuff for a CFR source, even if it's the same frame rate as the source, it can sometimes cause frames to be duplicated or dropped when they don't need to be, making the video look "jittery". Only add it when you need to do a VFR to CFR conversion, and if in doubt, convert to the maximum frame rate, and/or a standard frame rate.
Avisynth functions Resize8 Mod - Audio Speed/Meter/Wave - FixBlend.zip - Position.zip
Avisynth/VapourSynth functions CropResize - FrostyBorders - CPreview (Cropping Preview) -
Anonymous847344Guest
Great, gotcha. But right now I have other video with this:
Video
ID : 2
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L3.1
Format settings : CABAC / 2 Ref Frames
Format settings, CABAC : Yes
Format settings, Reference : 2 frames
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 3 h 30 min
Source duration : 3 h 30 min
Bit rate : 6 557 kb/s
Nominal bit rate : 3 060 kb/s
Width : 1 280 pixels
Height : 720 pixels
Display aspect ratio : 16:9
Frame rate mode : Variable
Frame rate : 52.493 FPS
Minimum frame rate : 0.009 FPS
Maximum frame rate : 90 000.000 FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.136
Stream size : 9.63 GiB (98%)
Source stream size : 9.63 GiB (98%)
Writing library : x264 core 148 r2579M 73ae2d1
Encoding settings : cabac=1 / ref=2 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=2 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=0 / me_range=16 / chroma_me=1 / trellis=0 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=0 / threads=4 / lookahead_threads=1 / sliced_threads=0 / nr=250 / decimate=1 / interlaced=0 / bluray_compat=0 / stitchable=1 / constrained_intra=0 / bframes=0 / weightp=1 / keyint=62 / keyint_min=6 / scenecut=40 / intra_refresh=0 / rc_lookahead=10 / rc=2pass / mbtree=1 / bitrate=3060 / ratetol=1.0 / qcomp=0.60 / qpmin=5 / qpmax=69 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / vbv_maxrate=6120 / vbv_bufsize=3060 / nal_hrd=none / filler=0 / ip_ratio=1.40 / aq=1:1.00
Color range : Limited
Color primaries : BT.709
Transfer characteristics : BT.709
Matrix coefficients : BT.709
mdhd_Duration : 12620990
Codec configuration box : avcC
Audio
ID : 1
Format : AAC LC SBR
Format/Info : Advanced Audio Codec Low Complexity with Spectral Band Replication
Commercial name : HE-AAC
Format settings : Implicit
Codec ID : mp4a-40-2
Duration : 3 h 4 min
Source duration : 3 h 30 min
Bit rate mode : Variable
Bit rate : 111 kb/s
Nominal bit rate : 127 kb/s
Maximum bit rate : 194 kb/s
Channel(s) : 2 channels
Channel layout : L R
Sampling rate : 48.0 kHz
Frame rate : 23.438 FPS (2048 SPF)
Compression mode : Lossy
Stream size : 146 MiB (1%)
Source stream size : 167 MiB (2%)
mdhd_Duration : 11059712
I put it then to a container (.mkv and then):
Video
ID : 2
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L3.1
Format settings : CABAC / 2 Ref Frames
Format settings, CABAC : Yes
Format settings, Reference : 2 frames
Codec ID : V_MPEG4/ISO/AVC
Duration : 3 h 30 min
Bit rate : 6 555 kb/s
Nominal bit rate : 3 060 kb/s
Width : 1 280 pixels
Height : 720 pixels
Display aspect ratio : 16:9
Frame rate mode : Variable
Frame rate : 52.493 FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.135
Stream size : 9.63 GiB (98%)
Writing library : x264 core 148 r2579M 73ae2d1
Encoding settings : cabac=1 / ref=2 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=2 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=0 / me_range=16 / chroma_me=1 / trellis=0 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=0 / threads=4 / lookahead_threads=1 / sliced_threads=0 / nr=250 / decimate=1 / interlaced=0 / bluray_compat=0 / stitchable=1 / constrained_intra=0 / bframes=0 / weightp=1 / keyint=62 / keyint_min=6 / scenecut=40 / intra_refresh=0 / rc_lookahead=10 / rc=2pass / mbtree=1 / bitrate=3060 / ratetol=1.0 / qcomp=0.60 / qpmin=5 / qpmax=69 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / vbv_maxrate=6120 / vbv_bufsize=3060 / nal_hrd=none / filler=0 / ip_ratio=1.40 / aq=1:1.00
Default : Yes
Forced : No
Color range : Limited
Color primaries : BT.709
Transfer characteristics : BT.709
Matrix coefficients : BT.709
Audio
ID : 1
Format : AAC LC SBR
Format/Info : Advanced Audio Codec Low Complexity with Spectral Band Replication
Commercial name : HE-AAC
Format settings : Implicit
Codec ID : A_AAC-2
Duration : 3 h 30 min
Bit rate : 111 kb/s
Channel(s) : 2 channels
Channel layout : L R
Sampling rate : 48.0 kHz
Frame rate : 23.438 FPS (2048 SPF)
Compression mode : Lossy
Stream size : 167 MiB (2%)
Default : Yes
Forced : No
-
My theory is this:
Unless a video comes from a non-industry source, such a a phone camera, I assume it's supposed to have an industry-standard CFR. Why it doesn't.... maybe frames were dropped when it was captured, or it was encoded in VFR mode with a program such as Handbrake etc.... but I'd generally start by converting to the next standard frame rate "up" from the average frame rate. For video that was once an NTSC source (DVD) it's easy.... converting to 29.97fps generally just adds back the duplicate frames that were dropped to make it VFR, and from there you can work out what you want to do with it for a new constant frame rate. If it's mostly "film" you could use TIVTC to remove the duplicate frames in the film sections for 23.976fps again, and to convert the 29.97fps sections to 23.976fps by removing frames with frame blending etc. But anyway...
I'd just pick the industry standard frame rate you think it's most likely to be (59.94fps for both your examples above), convert to that frame rate and use the script creator's preview to step through the frames and/or preview the video. If you're not seeing lots of duplicate frames and it's not jittery due to missing frames you probably picked the correct one. Having said that though...
I think some broadcasters use 59.94fps regardless of the original source rate. It might be 23.976fps with lots of repeated frames, or 29.97fps with every frame repeated, or true 59.94fps, or combinations, but assuming it was mostly film (23.976fps), after converting to a 59.94fps constant frame rate, you should see a pattern of two repeated frames, then three repeated frames, then two, and so on. If it was me I'd be wanting get rid of all the duplicates for a 23.976fps encode, but because it's VFR, you'd have to convert to a 59.94fps CFR first (so everything's playing at the correct speed) then use TIVTC to decimate the duplicates for 23.976fps, then save the script, open it with the AVS Cutter and add your trims. Hopefully all that makes sense, but for your above examples you should be fine converting to 59.94fps before adding the trims as you did previously (and the easiest way). I think the ridiculously low and ridiculously high frame rates reported by MediaInfo are just some sort of anomaly that can be ignored.
If in doubt though, split off a small sample and upload it for someone to look at it for you.Last edited by hello_hello; 11th Jun 2020 at 03:46.
Avisynth functions Resize8 Mod - Audio Speed/Meter/Wave - FixBlend.zip - Position.zip
Avisynth/VapourSynth functions CropResize - FrostyBorders - CPreview (Cropping Preview)
Similar Threads
-
VFR to CFR and Audio Sync
By videohelpuser in forum Video ConversionReplies: 3Last Post: 23rd Dec 2019, 10:46 -
I want to convert VFR to CFR while keeping the video interlaced
By ENunn in forum Video ConversionReplies: 34Last Post: 24th Apr 2019, 04:50 -
VFR TO CFR in avisynth 64bit and LSMASH source^?
By marcorocchini in forum Newbie / General discussionsReplies: 2Last Post: 22nd Oct 2017, 06:28 -
Turning video from VFR to CFR without re-encoding?
By yetanotherlogin in forum EditingReplies: 3Last Post: 29th Aug 2016, 10:09 -
VFR to CFR
By SameSelf in forum Video ConversionReplies: 6Last Post: 7th Jun 2016, 19:46