Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Video Encoding > MPEG-4 AVC / H.264
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 5th December 2009, 18:15   #1  |  Link
miskeen
Registered User
 
Join Date: Oct 2009
Posts: 10
Reduce the size (spatial resolution) of YUV file

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!
miskeen is offline   Reply With Quote
Old 5th December 2009, 18:33   #2  |  Link
nm
Registered User
 
Join Date: Mar 2005
Location: Finland
Posts: 2,641
Quote:
Originally Posted by miskeen View Post
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
nm is offline   Reply With Quote
Old 5th December 2009, 19:04   #3  |  Link
miskeen
Registered User
 
Join Date: Oct 2009
Posts: 10
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!
miskeen is offline   Reply With Quote
Old 5th December 2009, 20:08   #4  |  Link
nm
Registered User
 
Join Date: Mar 2005
Location: Finland
Posts: 2,641
Works for me. Post the full log from running that command in the command line. What's the problem exactly?
nm is offline   Reply With Quote
Old 5th December 2009, 20:27   #5  |  Link
miskeen
Registered User
 
Join Date: Oct 2009
Posts: 10
[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
miskeen is offline   Reply With Quote
Old 5th December 2009, 21:14   #6  |  Link
nm
Registered User
 
Join Date: Mar 2005
Location: Finland
Posts: 2,641
Quote:
Originally Posted by miskeen View Post
[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
nm is offline   Reply With Quote
Old 5th December 2009, 21:36   #7  |  Link
miskeen
Registered User
 
Join Date: Oct 2009
Posts: 10
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?
miskeen is offline   Reply With Quote
Old 5th December 2009, 22:34   #8  |  Link
nm
Registered User
 
Join Date: Mar 2005
Location: Finland
Posts: 2,641
Quote:
Originally Posted by miskeen View Post
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:

Code:
$ 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..
nm is offline   Reply With Quote
Old 5th December 2009, 23:26   #9  |  Link
miskeen
Registered User
 
Join Date: Oct 2009
Posts: 10
Thank you nm!
miskeen is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:15.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.