Log in

View Full Version : Resizing troubles


kypec
21st September 2017, 11:22
Hello guys, I'm having a problem to encode with x264 the following script:import vapoursynth as vs
core = vs.get_core()
video = core.ffms2.Source(source='D:/Video/PEPPA_PIG_GERALD_GIRAFFE/title01.mkv')
video = core.std.CropRel(video, 0, 0, 0, 2)
video = core.resize.Spline36(video, 720, 576)
video.set_output()

The input is MPEG2 ripped directly from PAL DVD (720x576) with MakeMKV.
When feeding the above script to encoder it results in"C:\Program Files (x86)\VapourSynth\core64\vspipe.exe" --y4m title01.vpy - | "D:\GDrive\AV\tools\avc\x264.exe" --demuxer y4m - --preset veryslow --tune animation --bitrate 320 --sar 64:45 --pass 1 --output NUL --no-progress

Error: Failed to retrieve frame 0 with error: Resize error 1027: image dimensions must be divisible by subsampling factor
Output 0 frames in 0.03 seconds (0.00 fps)
y4m [info]: 720x576p 64:45 @ 25/1 fps (cfr)
x264 [info]: using SAR=64/45
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
x264 [info]: profile Main, level 3.0
x264 [info]: final ratefactor: 34.77

How do I go about cropping/resizing in VS to avoid such errors? I'm a total noob in VapourSynth and never encountered these issues in Avisynth...:(

Myrsloik
21st September 2017, 11:37
So let's do some guessing. The file is definitely YUV420P8 format, so a multiple of 2 is required horizontally when resizing. OR a multiple of 4 if it's interlaced. Note that interlaced is set based on whether or not the source was encoded in a field based way, not necessarily if the actual contents is interlaced.

Try adding:
clip = core.std.SetFieldBased(clip, 0)
Directly after the source and see if it works

kypec
21st September 2017, 12:04
Yep, you were absolutely right. It didn't occur to me that the source may be encoded as interlaced. Your suggestion worked well. :thanks:
Here's Mediainfo for completenessVideo
ID : 1
ID in the original source medium : 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
Codec ID : V_MPEG2
Codec ID/Info : MPEG 1 or 2 Video
Duration : 5 min 5 s
Bit rate mode : Variable
Bit rate : 4 637 kb/s
Maximum bit rate : 9 800 kb/s
Width : 720 pixels
Height : 576 pixels
Display aspect ratio : 16:9
Frame rate mode : Constant
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.447
Time code of first frame : 00:59:59:00
Time code source : Group of pictures header
Stream size : 169 MiB (96%)
Language : English
Default : No
Forced : No
Original source medium : DVD-Video