[FFmpeg-user] container for yuv

Donald McLachlan Donald.McLachlan at crc.ca
Tue Dec 20 16:17:47 CET 2011



On 20/12/2011 9:35 AM, Dave Rice wrote:
> On Dec 20, 2011, at 9:29 AM, Donald McLachlan wrote:
>
>> Hi All,
>>
>> I'm not a video guy so please bear with me if I get some terminology not quite right.
>>
>> I was asked to convert a 4K video to YUV. So I used:
> The request doesn't really provide enough information. 4K is a vague reference to frame size while YUV is a colorspace. It may be that your 4K file is already in YUV. If not then you could convert it to yuv using the -pix_fmt option.
>
>>     ffmpeg -i inputFile.mp4 -f rawvideo outputFile.yuv
>>
>> Because the output file is raw video without a container, players like mplayer cannot play this file without being given the frame size etc. on the command line.
>>
>> I was pointed to YUV4MPEG2 http://wiki.multimedia.cx/index.php?title=YUV4MPEG2
>> I looked at the output of ffmpeg -codecs, but I did not see anything that looks like this, nor did I see anything that (to me) says it can put YUV into a container.
> yuv4mpeg2 is a format rather than a codec
> Try
> ffmpeg -i inputFile.mp4 -pix_fmt yuv420p -f yuv4mpegpipe outputFile.y4m
>
> If yuv420p is not appropriate use the correct pixel format for the situation. Also note that this command doesn't change the frame size so your output will still be 4K if the input is 4K.
> Dave Rice

Hi Dave,

I did not think the resolution of the video mattered, but I included it 
just in case.  Our goal is to have a file that requires minimal 
processing at playback time so were will to trade filesize versus cpu.  
I had checked -pix_fmts and -codecs, but I did not know to check 
-formats. As I said, I'm not a video guy. Thanks.  It works for us.  
Here is the header output of ffmpeg from a sample file we are using for 
in house testing.

    ffmpeg -i 'Lupe (4k resolution).mp4' -f yuv4mpegpipe Lupe4k.y4m
    ffmpeg version 0.8, Copyright (c) 2000-2011 the FFmpeg developers
       built on Nov 30 2011 13:01:22 with gcc 4.5.1 20101208
    [gcc-4_5-branch revision 167585]
       configuration:
       libavutil    51.  9. 1 / 51.  9. 1
       libavcodec   53.  7. 0 / 53.  7. 0
       libavformat  53.  4. 0 / 53.  4. 0
       libavdevice  53.  1. 1 / 53.  1. 1
       libavfilter   2. 23. 0 /  2. 23. 0
       libswscale    2.  0. 0 /  2.  0. 0

    Seems stream 1 codec frame rate differs from container frame rate:
    47.95 (5994/125) -> 23.98 (24000/1001)
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Lupe (4k resolution).mp4':
       Metadata:
         major_brand     : mp42
         minor_version   : 0
         compatible_brands: isomavc1mp42
         creation_time   : 2010-07-17 23:35:29
         title           : Lupe (4k resolution)
       Duration: 00:02:39.70, start: 0.000000, bitrate: 18790 kb/s
         Stream #0.0(und): Audio: aac, 48000 Hz, stereo, s16, 122 kb/s
         Metadata:
           creation_time   : 2010-07-17 23:35:29
         Stream #0.1(und): Video: h264 (High), yuv420p, 4096x2304 [PAR
    1:1 DAR 16:9], 18665 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 47.95 tbc
         Metadata:
           creation_time   : 2010-07-17 23:35:29
    [buffer @ 0x1264c00] w:4096 h:2304 pixfmt:yuv420p tb:1/1000000
    sar:1/1 sws_param:
    Output #0, yuv4mpegpipe, to 'Lupe4k.y4m':
       Metadata:
         major_brand     : mp42
         minor_version   : 0
         compatible_brands: isomavc1mp42
         creation_time   : 2010-07-17 23:35:29
         title           : Lupe (4k resolution)
         encoder         : Lavf53.4.0
         Stream #0.0(und): Video: rawvideo, yuv420p, 4096x2304 [PAR 1:1
    DAR 16:9], q=2-31, 200 kb/s, 90k tbn, 23.98 tbc
         Metadata:
           creation_time   : 2010-07-17 23:35:29
    Stream mapping:
       Stream #0.1 -> #0.0
    Press [q] to stop, [?] for help

Thanks again,
Don



More information about the ffmpeg-user mailing list