View Full Version : Reduce the size (spatial resolution) of YUV file
miskeen
5th December 2009, 18:15
Hi,
I need to reduce the spatial resolution of YUV files by a factor of 2, i.e from 352x288 to 176x144.
Can ffmpeg do this? How?
I'm looking especially for a piece of code that can be used under linux in a batch mode. Is there any solution please?
Thank you!
nm
5th December 2009, 18:33
Hi,
I need to reduce the spatial resolution of YUV files by a factor of 2, i.e from 352x288 to 176x144.
Can ffmpeg do this? How?
Use the -s parameter to scale. For example -s qcif or -s 176x144
And RTFM: http://ffmpeg.org/ffmpeg-doc.html#SEC9
miskeen
5th December 2009, 19:04
I tried this but it doesn't work:
ffmpeg -i flowey_cif.yuv -s qcif flower_qcif.yuv
For me, the input and output files are YUV files.
Thanks!
nm
5th December 2009, 20:08
Works for me. Post the full log from running that command in the command line. What's the problem exactly?
miskeen
5th December 2009, 20:27
[user@localhost ffmpeg]$ ./ffmpeg -i flower_cif.yuv -s qcif flower_qcif.yuv
FFmpeg version SVN-r20584, Copyright (c) 2000-2009 Fabrice Bellard, et al.
built on Nov 22 2009 17:57:57 with gcc 4.1.2 20080704 (Red Hat 4.1.2-44)
configuration:
libavutil 50. 4. 0 / 50. 4. 0
libavcodec 52.41. 0 / 52.41. 0
libavformat 52.39. 2 / 52.39. 2
libavdevice 52. 2. 0 / 52. 2. 0
libswscale 0. 7. 1 / 0. 7. 1
picture size invalid (0x0)
[rawvideo @ 0x8ef6420]Could not find codec parameters (Video: rawvideo, yuv420p)
flower_cif.yuv: could not find codec parameters
nm
5th December 2009, 21:14
[user@localhost ffmpeg]$ ./ffmpeg -i flower_cif.yuv -s qcif flower_qcif.yuv
[...]
picture size invalid (0x0)
[rawvideo @ 0x8ef6420]Could not find codec parameters (Video: rawvideo, yuv420p)
flower_cif.yuv: could not find codec parameters
Ah, you didn't specify source frame size, which is required for raw input. Try this:
./ffmpeg -s cif -i flower_cif.yuv -s qcif flower_qcif.yuv
miskeen
5th December 2009, 21:36
works for me now, thank you.
Is is possible to know which filter is used to downsample the YUV from CIF to QCIF, is it the mean of four pixels?
nm
5th December 2009, 22:34
Is is possible to know which filter is used to downsample the YUV from CIF to QCIF, is it the mean of four pixels?
I don't know which filter is now the default. Perhaps bicubic -- too tired to check the code.
But you can select a specific filter with parameter -sws_flags:
$ ffmpeg -h
[...]
SWScaler AVOptions:
-sws_flags <flags> E.V.. scaler/cpu flags
fast_bilinear E.V.. fast bilinear
bilinear E.V.. bilinear
bicubic E.V.. bicubic
experimental E.V.. experimental
neighbor E.V.. nearest neighbor
area E.V.. averaging area
bicublin E.V.. luma bicubic, chroma bilinear
gauss E.V.. gaussian
sinc E.V.. sinc
lanczos E.V.. lanczos
spline E.V.. natural bicubic spline
print_info E.V.. print info
accurate_rnd E.V.. accurate rounding
mmx E.V.. MMX SIMD acceleration
mmx2 E.V.. MMX2 SIMD acceleration
3dnow E.V.. 3DNOW SIMD acceleration
altivec E.V.. AltiVec SIMD acceleration
bfin E.V.. Blackfin SIMD acceleration
full_chroma_int E.V.. full chroma interpolation
full_chroma_inp E.V.. full chroma input
bitexact E.V..
miskeen
5th December 2009, 23:26
Thank you nm!
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.