Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Source Width must be even for YUV_420 colorspace #1

Open
ignace72 opened this issue Mar 9, 2023 · 1 comment
Open

Source Width must be even for YUV_420 colorspace #1

ignace72 opened this issue Mar 9, 2023 · 1 comment

Comments

@ignace72
Copy link

ignace72 commented Mar 9, 2023

Hello to all of you.
I am having a problem converting a really old film.
The characteristics of my source file:

Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : Main@L4
Format settings : CABAC / 4 Ref Frames
Format settings, CABAC : Yes
Format settings, Reference frames : 4 frames
Codec ID : V_MPEG4/ISO/AVC
Duration : 2 h 9 min
Bit rate : 18.0 Mb/s
Width : 1 480 pixels
Height : 1 080 pixels
Display aspect ratio : 1.370
Frame rate mode : Constant
Frame rate : 23.976 (24000/1001) FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.470
Stream size : 16.3 GiB (99%)
Writing library : x264 core 157 r2935 545de2f
Encoding settings : cabac=1 / ref=2 / deblock=1:0:0 / analyse=0x1:0x111 / me=hex / subme=6 / psy=1 / psy_rd=1.00:0. 00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=0 / cqm=0 / deadzone=21, 11 / fast_pskip=1 / chroma_qp_offset=- 2 / threads=18 / lookahead_threads=3 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=1 / keyint=240 / keyint_min=24 / scenecut=40 / intra_refresh=0 / rc_lookahead=30 / rc=abr / mbtree=1 / bitrate=18000 / ratetol=1. 0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / vbv_maxrate=20000 / vbv_bufsize=25000 / nal_hrd=none / filler=0 / ip_ratio=1.40 / aq=1:1.00
Language : French
Default : Yes
Forced : No
Color range : Limited
Color primaries : BT.709
Transfer characteristics : BT.709
Matrix coefficients : BT.709

My order is as follows:
ffmpeg -i Movie.mkv -map 0:v:0 -pix_fmt yuv420p10le -vf scale=-1:720 -f yuv4mpegpipe -strict -1 - | SvtAv1EncApp -i stdin --preset 6 --keyint 240 --input-depth 10 --crf 30 --rc 0 --passes 1 --film-grain 0 -b av1.ivf
My error message is as follows:

Svt[error]: Error Instance 1: Source Width must be even for YUV_420 colorspace
SvtMalloc[info]: you have no memory leak
av_interleaved_write_frame(): Broken tube
Pipe trailer write error: : Broken pipetime=00:00:00.04 bitrate=12587.3kbits/s speed=1.26x    
frame= 1 fps=0.0 q=-0.0 Lsize= 64kB time=00:00:00.04 bitrate=12587.3kbits/s speed=0.445x    
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 13803.389648%
Error closing the pipe file :: Broken pipe

Can someone point me in the right direction to solve my problem?
Thank you in advance.

@ArakiSatoshi
Copy link

ArakiSatoshi commented Nov 1, 2023

The issue is here:

Width : 1 480 pixels
Height : 1 080 pixels

The -vf scale=-1:720 filter tells ffmpeg to downscale your video to 720p while preserving the aspect ratio. Essentially, you're telling it to produce the video of this resolution:

Width : 986,666... pixels
Height : 720 pixels

Which will round up to 987x720. 987 isn't an even number, so you get the "Source Width" error.

There's an easy workaround, though:

-vf scale=-2:720

Specifying 2 instead of 1 will round up to an even number, and it should resolve the issue.

The correct command would be:

ffmpeg -i Movie.mkv -map 0:v:0 -pix_fmt yuv420p10le -vf scale=-2:720 -f yuv4mpegpipe -strict -1 - | SvtAv1EncApp -i stdin --preset 6 --keyint 240 --input-depth 10 --crf 30 --rc 0 --passes 1 --film-grain 0 -b av1.ivf

Or:

ffmpeg -i Movie.mkv -map 0:v:0 -c:v libsvtav1 -pix_fmt yuv420p10le -vf scale=-2:720 -g 240 -crf 30 -preset 6 -pass 1 -svtav1-params rc=0:film-grain=0 av1.ivf


This issue keeps showing up every time I click on the GitHub page instead of the GitLab one, so I felt obligated to answer. For any further issues, please use the GitLab repository, since the development moved there:
https://gitlab.com/AOMediaCodec/SVT-AV1/-/issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants