hello,
as some probably agree you can't go the above and beyond AviSynth filter and super slow x264 encoding way for all the stuff you are watching. So for specific cases where speed and simplicity (nothing batter than just moving your video into a cmd) is a priority over quality I wrote simple
ffmpeg batches to do the job. Here is a special case which gives me headaches.
I want to convert this interlaced 59.94 which was sourced from a proper NTSC-Video VHS (but sadly set to a variable Frame rate mode for the encode)
to progressive 29,97 and apply some deblocking to go with that because my stand alone player is not able to deinterlace this content (probably because of it being weirdly encoded)
My ffmpeg cmd for this would be
sample: https://workupload.com/file/8EW8FGRrB7gCode:"%FFMPEG%" -i %INPUTFILE% -filter:v "bwdif=mode=0:parity=0,fps=30000/1001",gradfun=3.5:8 -codec:v "libx264" -crf "18" -preset:v "veryfast" -fps_mode:v "cfr" -pix_fmt:v "yuv420p" -colorspace:v "bt709" -color_primaries:v "bt709" -color_trc:v "bt709" -color_range:v "tv" -map 0 -c:a copy -f matroska %1%.mkv
the problem is that I'm getting an output with a super weird variable framerate no matter what I do. I already set it correct with fps_mode:v "cfr"
. I tried adding -r 30000/1001 into the fold which also didn't help.
Is this a case of impossible or is there a way in the simple cmd/batch universe to solve this?
thanks in advance
regards
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays!
+ Reply to Thread
Results 1 to 12 of 12
Thread
-
-
This produces constant 29.97fps progressive here of this poor source:
Code:ffmpeg -i "%~1" -c:a:0 copy -c:v:0 libx264 -preset fast -crf 18 -filter:v:0 "bwdif=mode=0, format=yuv420p, setsar=1/1" "%~1_bwdif.mp4"
-
-
thanks, is that only possible when I do 2 jobs or is there a way to combine that with my other command line? I tried but got an error
[setts @ 000001c87d7450c0] [Eval @ 0000004fab3fe970] Undefined constant or missing '(' in 'startpts+n/tb_out/29.97'
[setts @ 000001c87d7450c0] Error while parsing ts expression 'startpts+n/tb_out/29.97'
[vost#0:0/libx264 @ 000001c87dd704c0] Error initializing bitstream filter: setts
[vost#0:0/libx264 @ 000001c87dd704c0] Error initializing output stream:
This shows that I have a framerate of 59940/1000 in media info but still declares the framerate mode as variable.
60i should still work tho if it would be constant but kind of strange the bwdif mode=0 doesn't reduce it to 29,97. For PAL it works like that and outputs 25p instead of 50 interlaced for deinterlacing standard VHS so kind of weird. -
The result of my commandline:
Frame rate mode : Constant
Frame rate : 29.970 (30000/1001) FPS -
Strange. This is what MediaInfo returned from my commandline
Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L3.1
Format settings : CABAC / 5 Ref Frames
Format settings, CABAC : Yes
Format settings, Reference frames : 5 frames
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 13 min 2 s
Bit rate : 8 965 kb/s
Width : 1 280 pixels
Height : 720 pixels
Display aspect ratio : 16:9
Frame rate mode : Constant
Frame rate : 29.970 (30000/1001) FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.325
Stream size : 836 MiB (97%)
Writing library : x264 core 164 r3191 4613ac3
.......... -
found the bug. I used "mkv" as an output container. Once I switched to mp4 (which was in your suggestion anyways) it worked. So its probably a bug of mkv tags or whatsoever not beeing displayed right in mpc.
and for prowo it probably was that he used clever FFmpeg-GUI which corrects it instead of just moving stuff in batches. -
It tends to be MP4 more than MKV for which MediaInfo incorrectly reports a variable frame rate, but maybe it's dependent on the program/encoder and the timecodes created. For MKV the frame durations are usually a whole number of milliseconds, but at 29.97fps the frame duration is actually 33.3667ms so there's a pattern of 33ms and 34ms frames. Like this:
0
33
67
100
133
167
200
234
As an experiment, try remuxing the MP4s and MKVs ffmpeg created with MKVToolNixGUI. Do it twice. Once using the defaults for MKVToolNix, and then remux them again while adding the following to the "Additional Options" section under the Output tab.
--disable-track-statistics-tags
That'll create MKVs without the tags for MediaInfo to read so it'll have to work out the frame rate for itself. I don't know if ffmpeg writes those tags, but with them MediaInfo might report something different.
And if in doubt you can always add Info() to the end of the Avisynth script as it includes the frame rate, if that's your input video. If Avisynth reports 30000/1001 the script's frame rate is okay and you shouldn't have to worry about the frame rate MediaInfo reports. By the way, if you are using Avisynth for that video, it's possible to make the chroma slightly less horrible. I only had a quick play with it.
BWDIF(field=-1)
CropResize(0,720, 160,10,-168,-14)
[Attachment 80179 - Click to enlarge]
ShiftUVMod(uy=-4, vy=-4)
BWDIF(field=-1)
MergeChroma(Awarpsharp2(Depth=30))
CropResize(0,720, 160,10,-168,-14)
[Attachment 80180 - Click to enlarge]Avisynth functions Resize8 Mod - Audio Speed/Meter/Wave - FixBlend.zip - Position.zip
Avisynth/VapourSynth functions CropResize - FrostyBorders - CPreview (Cropping Preview) -
Similar Threads
-
Dropped frames after converting interlaced to progressive with VirtualDub2
By Hajker in forum Newbie / General discussionsReplies: 5Last Post: 16th Jan 2023, 06:09 -
StaxRip how to get constant framerate and detelecine?
By Firestorm in forum Video ConversionReplies: 5Last Post: 23rd Aug 2022, 04:02 -
interlaced mpeg2 ts viewing and converting to deinterlaced progressive
By patrick1 in forum Newbie / General discussionsReplies: 15Last Post: 3rd Dec 2021, 13:20 -
What's the best way to convert Variable to Constant Framerate nowadays?
By Dagger7 in forum Video ConversionReplies: 3Last Post: 2nd Oct 2021, 14:31 -
Converting to constant framerate with Handbrake - Audio out of sync
By m1ke in forum Video ConversionReplies: 3Last Post: 1st Nov 2020, 18:27