Skip to content

change output resolution in stream io #38

Answered by tikuma-lsuhsc
sugizo asked this question in Q&A
Discussion options

You must be logged in to vote

The correct approach is to make the reader to output small frames:

with ffmpegio.open(input, 'rv', s=(180,320)) as fin, ffmpegio.open(output, 'wv', rate_in = fin.rate, overwrite = True) as fout:
    ...

The FFmpeg s option (or -s option in cli) sets the output frame size (implicitly inserts a resize filter). If you wish to only set height or width and automatically scale the other, keeping the aspect ratio, specify the dependent dimension as -1 or -2 if you need to make sure even number of pixels. For example,

with ffmpegio.open(input, 'rv', s=(180,-1)) as fin, ffmpegio.open(output, 'wv', rate_in = fin.rate, overwrite = True) as fout:
    ...

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by sugizo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants