Hi but I'm a c**
please I wonder how to convert a 50P source into 25P using ffmpeg (and not using a simple "-vf interlace" filter) possibly without too much quality loss
thanks
+ Reply to Thread
Results 1 to 18 of 18
-
-
Did you mean normal playback, not "slow motion" half speed at 25p ?
This will drop 1 out of every 2 frames and adjust the input framerate by 1/2 accordingly
Code:-vf decimate=cycle=2
-
mmm cat
my source is 1920x1080, 422, and 50P
I need to reduce to a mp4 that is 411, 720x576, and 25P
I should use something like:
Code:ffmpeg64bit332.exe -threads 8 -y -i %4 -i %audiosource% -vf decimate=cycle=2,scale=w=720:h=576,scale=interl=1:in_range=tv:out_range=tv,unsharp=luma_msize_x=3:luma_msize_y=3:luma_amount=0.8,colormatrix=bt709:bt601 -sws_flags lanczos+accurate_rnd -pix_fmt yuv420p -c:v libx264 -profile:v main -level:v 4.1 -x264-params me_range=4:subme=4:rc_lookahead=1:ref=3:chroma-me=1:chroma_qp_offset=0:qpmin=0:qpmax=69:sliced_threads=0:b_pyramid=2:b_adapt=1:b_bias=0:8x8dct=1:cabac=1:constrained_intra=0:no-psy=1:scenecut=40:ipratio=1.1 -g 72 -bf 2 -crf 22.8 -an -aspect 16:9 lowResOutput.mp4
OR
more simply I try to use the -r 25 ? like this
Code:ffmpeg64bit332.exe -threads 8 -y -i %4 -i %audiosource% -vf scale=w=720:h=576,scale=interl=1:in_range=tv:out_range=tv,unsharp=luma_msize_x=3:luma_msize_y=3:luma_amount=0.8,colormatrix=bt709:bt601 -sws_flags lanczos+accurate_rnd -r 25 -pix_fmt yuv420p -c:v libx264 -profile:v main -level:v 4.1 -x264-params me_range=4:subme=4:rc_lookahead=1:ref=3:chroma-me=1:chroma_qp_offset=0:qpmin=0:qpmax=69:sliced_threads=0:b_pyramid=2:b_adapt=1:b_bias=0:8x8dct=1:cabac=1:constrained_intra=0:no-psy=1:scenecut=40:ipratio=1.1 -g 72 -bf 2 -crf 22.8 %AudioSettings% -aspect 16:9 lowResOutput.mp4
-
Probably 4:2:0 ? 4:1:1 is for NTSC DV
scale=interl=1
Try it and see which you like better. -r as an output option should work, but I noticed -r gives problems in some cases with timecodes. Actually decimate sometimes doesn't work either. Both can be inconsistent in ffmpeg -
eg. here is a test file "1.mp4" as the "source". Each frame has a framenumber written on it 0,1,2.... 640x480p50 CFR. 500 frames
ffmpeg -i 1.mp4 -vf decimate=cycle=2 -c:v libx264 -crf 20 -an 1_dec.mp4
ffmpeg -i 1.mp4 -r 25 -c:v libx264 -crf 20 -an 1_r25.mp4
Both have errors.
1_dec selects even numbers, so it should go 0,2,4,6 . But it has 1,2,4,7 at the beginning. Some frames are not selected correctly, so that will lead to less smooth motion eg. 17,27,31,37, many more. But frame count is correct (250) and it should be in sync if it were a real example with audio
1_r25 selects odd numbers , so it should go 1,3,5,7... But it has 0,1,2,3 at the beginning. Framecount is 152 (incorrect) . But there aren't mistakes after the beginning. If you drop frame 0,2 it looks correct (252-2 = 250)
So ffmpeg is semi-reliable for this sort of thing. YMMV. -r looks less bad in this case, after the beginning, but might cause sync issues.
avisynth or vapoursynth are more accurate and reliable for those types of operations such as decimation, field matching . You see these types of errors when IVTCing (e.g. DVD's) as well with ffmpeg, where the wrong frame is dropped or wrong frame duplicated -
Nice
-vf decimate might work if the settings and thresholds were adjusted. It's more like adaptive decimation with detection so it might choose the wrong one. So in hindsight that's the wrong one to choose for this situation
-r should have worked on this synthetic example, because timestamps were perfect -
Last edited by Sharc; 27th Dec 2019 at 12:39.
-
-
-
-
in my case:
this is my source (codec=Grass Valley Lossless; YUV422;1920x1080@50P)
https://www.dropbox.com/s/d07a3zb7eb8at4a/example.avi?dl=0
my target, this time, is a simple preview over phones so very low quality because I only need to scale the source from high qualityHD 422 -->to SD 420
Priority is for speed encoding
if I use:
Code:ffmpeg64bit2019.exe -threads 8 -y -i %4 -i %audiosource% -vf scale=w=720:h=576:in_range=tv:out_range=tv,unsharp=luma_msize_x=3:luma_msize_y=3:luma_amount=0.8,colormatrix=bt709:bt601 -sws_flags lanczos+accurate_rnd -r 25 -pix_fmt yuv420p -c:v libx264 -profile:v main -level:v 4.1 -x264-params me_range=4:subme=4:rc_lookahead=1:ref=3:chroma-me=1:chroma_qp_offset=0:qpmin=0:qpmax=69:sliced_threads=0:b_pyramid=2:b_adapt=1:b_bias=0:8x8dct=1:cabac=1:constrained_intra=0:no-psy=1:scenecut=40:ipratio=1.1 -g 72 -bf 2 -crf 22.8 -an -aspect 16:9 R25.MP4
I get this result:
https://www.dropbox.com/s/lf1i4ri9zb0jnzh/R25.mp4?dl=0
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
now I try without the -25 but using the
Code:ffmpeg64bit2019.exe -threads 8 -y -i %4 -i %audiosource% -vf decimate=cycle=2,scale=w=720:h=576:in_range=tv:out_range=tv,unsharp=luma_msize_x=3:luma_msize_y=3:luma_amount=0.8,colormatrix=bt709:bt601 -sws_flags lanczos+accurate_rnd -pix_fmt yuv420p -c:v libx264 -profile:v main -level:v 4.1 -x264-params me_range=4:subme=4:rc_lookahead=1:ref=3:chroma-me=1:chroma_qp_offset=0:qpmin=0:qpmax=69:sliced_threads=0:b_pyramid=2:b_adapt=1:b_bias=0:8x8dct=1:cabac=1:constrained_intra=0:no-psy=1:scenecut=40:ipratio=1.1 -g 72 -bf 2 -crf 22.8 -an -aspect 16:9 decimateCycle2.mp4
https://www.dropbox.com/s/x6mgk4mqc746bsd/decimateCycle2.mp4?dl=0
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
now I try without the -25 and without decimate=cycle=2 but using -filter:v "fps=25.0"
Code:ffmpeg64bit2019.exe -threads 8 -y -i %4 -i %audiosource% -filter:v "fps=25.0" -vf scale=w=720:h=576:in_range=tv:out_range=tv,unsharp=luma_msize_x=3:luma_msize_y=3:luma_amount=0.8,colormatrix=bt709:bt601 -sws_flags lanczos+accurate_rnd -pix_fmt yuv420p -c:v libx264 -profile:v main -level:v 4.1 -x264-params me_range=4:subme=4:rc_lookahead=1:ref=3:chroma-me=1:chroma_qp_offset=0:qpmin=0:qpmax=69:sliced_threads=0:b_pyramid=2:b_adapt=1:b_bias=0:8x8dct=1:cabac=1:constrained_intra=0:no-psy=1:scenecut=40:ipratio=1.1 -g 72 -bf 2 -crf 22.8 -an -aspect 16:9 filterV25.mp4
getting:
https://www.dropbox.com/s/shjl4ps166hw2up/filterV25.mp4?dl=0
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
try to confront quality and "smoothness" in edius
[Attachment 51224 - Click to enlarge]
and SEEMS that
R25.mp4 is the "best" but is not in sync frame by frame (seems shifted of 1 frame backwards) but also maybe oversharp if compared with the original clip
Decimate
decimateCycle2.mp4 is "good" but seems a little jerky during playback (and not oversharp), but in sync frame by frame with the original clip
filterV25.mp4 is very smooth playback and is in sync frame by frame with the original clip but seems to have details slightly "corrupted", detail seems not smoothLast edited by marcorocchini; 27th Dec 2019 at 16:40.
-
-r after the -i is an output option, is it not?
-r before the -i is an input option, or at least it used to be. Did something change ?
Why does it not work properly here ?
There are better filters for dropping every 2nd frame, like select filter.
How would you use it in this scenario, or what is the syntax. It seems like you have to combine it with some filter or method of dropping frames
But -vf fps seems to work ok as expected -
This is 50p . The fps didn't work. I think it has to be in the same filter graph as the other filters
(That would explain the "very smooth" playback and detail problems - crf encoding will raise quantizer based on framerate)
R25.mp4 is the "best" but is not in sync frame by frame (seems shifted of 1 frame backwards) but also maybe oversharp if compared with the original clip
Decimate
-r should "just work" in theory. But 2 samples, 2 buggy results so far....
I think you are oversharpening it with your "unsharp" filter on all of them . Very bad on dress pattern - aliasingLast edited by poisondeathray; 27th Dec 2019 at 21:53.
-
Your filterV25.mp4 is still 50fps. You can't simply daisy-chain the two filters.
This (simplified) should work:
ffmpeg.exe -i "%~1" -filter:v "scale=w=720:h=576, fps=25.0" -c:v libx264 -crf 22.8 -an -aspect 16:9 filt_new25.mp4
You may also want to read this:
https://trac.ffmpeg.org/wiki/ChangingFrameRateLast edited by Sharc; 28th Dec 2019 at 05:56. Reason: Link added
-
oh my ***
it's true filterV25.mp4 is a 50P
so this is the new commanline:
Code:ffmpeg64bit2019.exe -threads 8 -y -i v:\example.avi -filter:v "fps=25.0,scale=w=720:h=576:in_range=tv:out_range=tv,unsharp=luma_msize_x=3:luma_msize_y=3:luma_amount=0.3,colormatrix=bt709:bt601" -sws_flags lanczos+accurate_rnd -pix_fmt yuv420p -c:v libx264 -profile:v main -level:v 3.1 -x264-params me_range=4:subme=4:rc_lookahead=1:ref=3:chroma-me=1:chroma_qp_offset=0:qpmin=0:qpmax=69:sliced_threads=0:b_pyramid=2:b_adapt=1:b_bias=0:8x8dct=1:cabac=1:constrained_intra=0:no-psy=1:scenecut=40:ipratio=1.1 -g 72 -bf 2 -crf 22.8 -an -aspect 16:9 out.mp4
so I get this:
https://www.dropbox.com/s/876lxbv2209nomr/out.mp4?dl=0
and this seems "good" but the comparison frame to frame compared to the original example.avi (using the first frame) show that out.mp4 is not exactly in sync. As poison said there is a wrong selection at the beginning.
Is there a way to solve this problem?
and can I to incorporate the "-sws_flags lanczos+accurate_rnd" into the
Code:-filter:v "fps=25.0,scale=w=720:h=576:in_range=tv:out_range=tv,unsharp=luma_msize_x=3:luma_msize_y=3:luma_amount=0.3,colormatrix=bt709:bt601"
Last edited by marcorocchini; 28th Dec 2019 at 14:09.
-
It looks ok in terms of frame selection.
example.avi was 50p. out.mp4 is 25p. But correct "even" frames are selected. 0,2,4,6....
and can I to incorporate the "-sws_flags lanczos+accurate_rnd" into the
Code:-filter:v "fps=25.0,scale=w=720:h=576:in_range=tv:out_range=tv,unsharp=luma_msize_x=3:luma_msize_y=3:luma_amount=0.3,colormatrix=bt709:bt601"
because those flags are part of the scale filter
Code:"fps=25.0,scale=w=720:h=576:in_range=tv:out_range=tv:flags=lanczos+accurate_rnd,unsharp=luma_msize_x=3:luma_msize_y=3:luma_amount=0.3,colormatrix=bt709:bt601"
Similar Threads
-
50p video just patched to play back as 25p - can it be done?
By larioso in forum Video ConversionReplies: 6Last Post: 6th Jun 2019, 22:32 -
Having slow motion in 50p playback - destructive convert to 25p film?
By larioso in forum Camcorders (DV/HDV/AVCHD/HD)Replies: 0Last Post: 4th Jun 2019, 04:26 -
download 1080/50p or 4k/50p from youtube
By darknesslord in forum Video Streaming DownloadingReplies: 7Last Post: 16th Jun 2017, 07:37 -
Convert to 25P or 50P using interlaced footage
By Sir_Loin in forum Video ConversionReplies: 10Last Post: 6th May 2016, 17:08 -
Converting 50p to 25p without simply dropping frames
By Dave2ic in forum Video ConversionReplies: 39Last Post: 22nd Jan 2015, 03:27