hey guys,
I want to convert my VHS captures which are all single mpeg2 files with audio and in interlaced PAL to regular progressive h264 mp4 files. And I would love to do this in one step. I thought the most easy way to do that would be my beloved ffmpeg which I use for a long time for almost everything.
However it sadly doesn't work. Is there a way that -vf and -c:v could work together in one batch/cmd ?. Or will this always be 2 step scenario?
Maybe I made a mistake? Here is my cmd maybe you guys have an idea. Thanks for looking
cheers
Code:"%FFMPEG%" -i %INPUTFILE% -map 0:v -map 1:a -acodec ac3 -ar 48000 -ab 192k -vf "bwdif=mode=0:parity=0,fps=25000/1000" -c:v libx264 -pix_fmt yuv420p -profile:v high -level:v 4.1 -preset slow -tune film -crf 16 -x264opts bluray-compat=1:min-keyint=25:b-adapt=2:me=umh:vbv-bufsize=5000:vbv-maxrate=10000:colorprim=bt601:transfer=bt601:colormatrix=bt601:sar=12/11 -fflags +genpts -bsf:v h264_mp4toannexb %1%.mp4
+ Reply to Thread
Results 1 to 11 of 11
-
-
Deinterlacing as video filter and the selection of a video codec will certainly work as a sequence in the same pass.
If it "does not work", you may have chosen either the wrong kind of deinterlacing filter ("bob weave" is not one I would prefer first if I want progressive same-frame-rate results, possibly rather yadif – see an overview) or unfortunate parameters for it.
Some ffmpeg parameters work best in a certain order; I would recommend using the support of tools which have some expertise in building ffmpeg command lines, like Clever FFmpeg-GUI or Hybrid. -
Do you know any recent overview and comparison of ffmpeg deinterlacing filters, instead of just complaining?
It may be old but doesn't look completely irrelevant to me. There are more choices now, but those mentioned still exist.
A certainly recent documentation is the complete ffmpeg filters list. Enjoy searching through it for those you are interested in; and it doesn't have examples in the expected syntax even. -
thanks for the suggestions but I would rather use my own command line.
I rewrote my line like this
Code:"%FFMPEG%" -i %INPUTFILE% -map 0:v -map 1:a -c:v libx264 -vf "yadif=mode=0:parity=0,deint=0,fps=25000/1000, format=yuv420p" -profile:v high -level:v 4.1 -preset ultrafast -tune film -crf 16 -x264opts bluray-compat=1:min-keyint=25:b-adapt=2:me=umh:vbv-bufsize=5000:vbv-maxrate=10000:colorprim=bt601:transfer=bt601:colormatrix=bt601:sar=12/11 -acodec ac3 -ar 48000 -ab 192k -fflags +genpts -bsf:v h264_mp4toannexb %1%.mp4
-
ffprobe
Code:Input #0, mpeg, from '..............mpg': Duration: 01:39:25.92, start: 0.235211, bitrate: 4875 kb/s Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p(tv, bt470bg, top first), 720x576 [SAR 16:15 DAR 4:3], 25 fps, 25 tbr, 90k tbn Side data: cpb: bitrate max/min/avg: 9400000/0/0 buffer size: 1835008 vbv_delay: N/A Stream #0:1[0x80]: Audio: ac3, 48000 Hz, stereo, fltp, 256 kb/s
Code:General Complete name : ............mpg Format : MPEG-PS File size : 3.39 GiB Duration : 1 h 39 min Overall bit rate mode : Variable Overall bit rate : 4 876 kb/s Video ID : 224 (0xE0) Format : MPEG Video Format version : Version 2 Format profile : Main@Main Format settings : CustomMatrix / BVOP Format settings, BVOP : Yes Format settings, Matrix : Custom Format settings, GOP : Variable Format settings, picture structure : Frame Duration : 1 h 39 min Bit rate mode : Variable Bit rate : 4 523 kb/s Maximum bit rate : 9 400 kb/s Width : 720 pixels Height : 576 pixels Display aspect ratio : 4:3 Frame rate : 25.000 FPS Standard : PAL Color space : YUV Chroma subsampling : 4:2:0 Bit depth : 8 bits Scan type : Interlaced Scan order : Top Field First Compression mode : Lossy Bits/(Pixel*Frame) : 0.436 Time code of first frame : 00:00:00:00 Time code source : Group of pictures header GOP, Open/Closed : Open GOP, Open/Closed of first frame : Closed Stream size : 3.14 GiB (93%) Color primaries : BT.601 PAL Transfer characteristics : BT.470 System B/G Matrix coefficients : BT.470 System B/G Audio ID : 189 (0xBD)-128 (0x80) Format : AC-3 Format/Info : Audio Coding 3 Commercial name : Dolby Digital Muxing mode : DVD-Video Duration : 1 h 39 min Bit rate mode : Constant Bit rate : 256 kb/s Channel(s) : 2 channels Channel layout : L R Sampling rate : 48.0 kHz Frame rate : 31.250 FPS (1536 SPF) Compression mode : Lossy Stream size : 182 MiB (5%) Service kind : Complete Main Menu Format : DVD-Video
-
You're command line is specifying audio from a second source but you never input that second source. If you want audio from the same source specify -map 0:a, not -map 1:a. Your Yadif syntax is wrong. There should be a colon between each parameter, not a comma . Try bwdif instead of Yadif. It's much better. And double rate deinterlace to 50 fps to get full motion smoothness. There's no color format named bt601. Use bt470bg.
Audio from same file, yadif to 50p, bt601 colors:
Code:"%FFMPEG%" -i %INPUTFILE% -map 0:v -map 0:a -c:v libx264 -vf "yadif=mode=1:parity=0:deint=0,format=yuv420p" -profile:v high -level:v 4.1 -preset ultrafast -tune film -crf 16 -x264opts bluray-compat=1:min-keyint=25:b-adapt=2:me=umh:vbv-bufsize=5000:vbv-maxrate=10000:colorprim=bt470bg:transfer=bt470bg:colormatrix=bt470bg:sar=12/11 -acodec ac3 -ar 48000 -ab 192k -fflags +genpts -bsf:v h264_mp4toannexb %1%.mp4
Last edited by jagabo; 30th Oct 2022 at 06:13.
-
OK, new to me that this means an elaborate deinterlacer, not just bobbing or weaving. It's also available for VapourSynth and AviSynth, nice to have.
-
Hello.
This probably won't help, and no doubt people can validly criticise and make better recommendations, however here's an example of ffmpeg which was built with vapoursynth support and popped into the top level vapoursynth install folder.
It is provided only as an example, rather than a "use this it is fantastic high quality" suggestion (which doesn't suit some of my "wants").
It requires a 10 series or higher nvidia gpu card and up to date drivers for gpu encoding etc.
It uses Donald Graft's free DG tools in vapoursynth to do the deinterlacing and denoising and sharpening etc for SD sources.
Results are quite reasonable given the TV capture SD sources and is relatively speedy given gpu accelerated decoding and denoising and sharpening and encoding.
"Good enough" for my SD TV purposes.
If I wanted a "higher quality" result (unlikely for that type of source and nature of material) then I'd probably lean more for the suggestions above.
Like I said, provided as an example only
Cheers
Code:"%ffmpeg%" -hide_banner -v verbose -nostats -f vapoursynth -i "input_file.vpy" -probesize 200M -analyzeduration 200M -i "input_file.mpg" -map 0:v:0 -map 1:a:0 -vf "setdar=16/9" -vsync 0 -sws_flags lanczos+accurate_rnd+full_chroma_int+full_chroma_inp -strict experimental -c:v h264_nvenc -pix_fmt nv12 -preset p7 -multipass fullres -forced-idr 1 -g 25 -coder:v cabac -spatial-aq 1 -temporal-aq 1 -dpb_size 0 -bf:v 3 -b_ref_mode:v 0 -rc:v vbr -cq:v 0 -b:v 2000000 -minrate:v 100000 -maxrate:v 4000000 -bufsize 4000000 -profile:v high -level 5.2 -movflags +faststart+write_colr -af "adelay=delays=25ms:all=1" -c:a libfdk_aac -cutoff 20000 -ab 256k -ar 48000 -y "input_file.mp4"
Code:import vapoursynth as vs # this allows use of constants eg vs.YUV420P8 from vapoursynth import core # actual vapoursynth core #import functool #import mvsfunc as mvs # this relies on the .py residing at the VS folder root level - see run_vsrepo.bat #import havsfunc as haf # this relies on the .py residing at the VS folder root level - see run_vsrepo.bat core.std.LoadPlugin(r'C:\SOFTWARE\Vapoursynth-x64\DGIndex\DGDecodeNV.dll') # do it like gonca https://forum.doom9.org/showthread.php?p=1877765#post1877765 core.avs.LoadPlugin(r'C:\SOFTWARE\Vapoursynth-x64\DGIndex\DGDecodeNV.dll') # do it like gonca https://forum.doom9.org/showthread.php?p=1877765#post1877765 # NOTE: deinterlace=1, use_top_field=True for "Interlaced"/"TFF" "MPEG-2V"/"MPA1L2" video = core.dgdecodenv.DGSource(r'D:\VRDTVSP-SCRATCH\input_file.QSF.dgi', deinterlace=1, use_top_field=True, use_pf=False) # DGDecNV changes - # 2020.11.07 Revised DGDenoise parameters. The 'chroma' option is removed. # Now, if 'strength' is set to 0.0 then luma denoising is disabled, # and if cstrength is set to 0.0 then chroma denoising is disabled. # 'cstrength' is now defaulted to 0.0, and 'searchw' is defaulted to 9. # example: video = core.avs.DGDenoise(video, strength=0.06, cstrength=0.06) # replaced chroma=True video = core.avs.DGDenoise(video, strength=0.06, cstrength=0.06) # replaced chroma=True # example: video = core.avs.DGSharpen(video, strength=0.3) video = core.avs.DGSharpen(video, strength=0.3) #video = vs.core.text.ClipInfo(video) video.set_output()
Last edited by hydra3333; 31st Oct 2022 at 01:17.
Similar Threads
-
FFMPEG Deinterlace
By Tom4 in forum EditingReplies: 3Last Post: 2nd Jun 2022, 03:28 -
ffmpeg h264 guide related
By Anonymous543 in forum Newbie / General discussionsReplies: 10Last Post: 16th Dec 2021, 07:24 -
Issue with h264 deinterlace in Avisynth
By mrwhitethc in forum Video ConversionReplies: 5Last Post: 14th Nov 2021, 10:50 -
Get the complete FFmpeg command line when using FFmpeg Batch Converter
By pascor in forum Newbie / General discussionsReplies: 8Last Post: 13th May 2021, 23:14 -
How to get ffmpeg deinterlace to work like handbrake decomb
By ptr727 in forum Video ConversionReplies: 7Last Post: 17th Mar 2019, 20:03