Hi,
however the cats, however.
Please consider this MP4 source:
https://www.swisstransfer.com/d/361eb4cf-b997-4f2d-a0d1-a2b08311b6ba
is a variable framerate mp4 source
that I have put in c:\
and consider this package that contain 4 files:
https://www.swisstransfer.com/d/4811dda1-2647-4d8b-9039-2a5d3b6cccd5
please downaload and locate they in c:\ so you have
Code:c:\VFR .avs c:\LSMASHSource.dll c:\masktools2.dll c:\smoothFPS2.avsi
Now c:\VFR .avs is:
I encode this avs to get a video part in 50P, but the audio part extracted usingCode:LoadPlugin("c:\LSMASHSource.dll") LoadPlugin("c:\masktools2.dll") Import("c:\smoothFPS2.avsi") vid=LWLibavVideoSource("C:\VFR .mp4") aud=LWLibavAudioSource("C:\VFR .mp4",stream_index=1) left=GetChannel(aud, 1) right=GetChannel(aud, 2) both=mergechannels(left, right) audiodub(vid, both) ConvertAudioTo16Bit() LancZosResize(1920,1080) converttoYV12(interlaced=false) emask = mt_convolution(vertical="-1 2 -1").ColorYUV(off_y=-64).ColorYUV(gain_y=128).mt_expand(chroma="-128").Blur(0.8) Overlay(last, Blur(0.8, 0.8), mask=emask) SmoothFPS2(50000,1000) assumefps(50) Prefetch(8)
seems to have audio in sligh dissync with the video part.Code:ffmpeg.exe -y -i "c:\VFR .avs" -c:a pcm_s16le -ar 48000 out.wav
I wonder if is there a way to adjust the audio wav file usign something like "time stretch" filter or the avisnth script sot that it output an audio part that have the correct sync with video
thanks![]()
+ Reply to Thread
Results 1 to 11 of 11
-
-
why exactly 30000 ?
mediainfo report tell the source is "29,314 FPS"
using "my" fps extract subroutine I get the Real FPS is "29.9166666666667"
However I have to use the line
Code:vid=LWLibavVideoSource("C:\VFR .mp4", fpsnum=30000, fpsden=1000)
I mean: I'm in a batch procedure, in what way I need to get automatically the fpsnum value? -
I picked 30000 because MediaInfo reported the "real frame rate" as 30.000. Also, examining the timestamps from ffprobe showed the majority of the durations around 1/30 second. And using that rate showed pretty smooth motion (aside from the jerky camerawork). There are occasional frames with durations around 1/15 second. Those show up as duplicates when you convert to 30 fps CFR.
-
Supplying fpsnum and fpsden to LWlibavVideoSource forces it return the constant frame rate specified. VFR frames will be duplicated and/or discarded to match the requested frame rate. If you don't specify a constant frame rate LWlibavVideoSource will return one frame for each frame in the video. It will then use the running time and the number of frames to generate an average frame rate. Audio will be in sync at the start and end -- but if the distribution of frame times is not consistent the audio may be off at other points in the video. If you want to keep the video VFR you have to extract the time codes from the original video, then remux them with the final video. You can't do that here because you are changing the frame rate. There is no longer a 1:1 correspondence between the original time codes and the new frames.
If you're encoding the output of the specified AVS script you don't need to tell ffmpeg the frame rate. It will get the frame rate from AviSynth. -
ok thanks, but another question:
suppose to have a source like this drone MP4 that is not variable framerate, but have
framerate : 29,970
and
Original frame rate : 29,000
MediaInfo show:
Code:Video ID : 1 Format : AVC Format/Info : Advanced Video Codec Format profile : High@L4.1 Format settings, CABAC : Si Format settings, ReFrames : 1 frame Format settings, GOP : M=1, N=29 Codec ID : avc1 Codec ID/Info : Advanced Video Coding Duration : 1 min 2s Bit rate : 36,2 Mb/s Width : 1.920 pixel Height : 1.080 pixel Display aspect ratio : 16:9 Frame rate mode : Costante Frame rate : 29,970 (30000/1001) FPS Original frame rate : 29,000 FPS Color space : YUV Chroma subsampling : 4:2:0 Bit depth : 8 bit Scan type : Progressivo Bits/(Pixel*Frame) : 0.582 Stream size : 269MiB (100%) Encoded date : UTC 2022-07-20 20:08:56 Tagged date : UTC 2022-07-20 20:08:56
Code:LWLibavVideoSource("C:\Users\Administrator\Desktop\30fps drone.MP4", fpsnum= , fpsden= )
-
You'll probably want to use 30000 and 1001 in that case. But you'll have to test to be sure. I suspect a 29 fps video was sped up to 29.97 fps without reencoding.
-
https://www.swisstransfer.com/d/01cd3fd4-9f54-4a96-8550-f169048a5bc4
this is the "30" fps video file, if I don't mystake seems that this is the "30 fps recording mode" of the dji mini 3 drone but if I leave don't inlcude the field fpsnum= , fpsden= what happens? -
Since it is CFR 29.97 it plays smoothly at 29.97 fps. If you use fpsnum/fpsden to change it to 29 fps it will be jerky as 1 of every 30 frames will be discarded.
-
By the way, the occasional duplicates in the earlier video (after converting to CFR, before changing the frame rate to 50p) can be fixed with FillDrops(). See the thread here:
https://forum.videohelp.com/threads/409885-Every-6th-Frame-is-a-repeat-How-to-Fix#post2695848
Similar Threads
-
Ffmpeg piped as source to avisynth
By Budman1 in forum Video ConversionReplies: 14Last Post: 22nd Jul 2024, 11:55 -
ffmpeg MKV to MP4 without rencode makes output frame rate variable?
By Anonymous543 in forum Newbie / General discussionsReplies: 26Last Post: 1st May 2024, 17:05 -
Variable Framerate Ouput (Avisynth)
By Vaengence in forum Video ConversionReplies: 11Last Post: 20th Nov 2022, 13:50 -
Variable Framerate Video
By killerteengohan in forum RestorationReplies: 3Last Post: 16th Oct 2022, 10:57 -
Why do MP4 splitters always create a file with a variable framerate?
By Hypersonic1 in forum Newbie / General discussionsReplies: 26Last Post: 3rd Nov 2018, 15:55