[FFmpeg-user] container for yuv

Donald McLachlan Donald.McLachlan at crc.ca
Tue Dec 20 17:08:24 CET 2011



On 20/12/2011 10:25 AM, Dave Rice wrote:
> On Dec 20, 2011, at 10:17 AM, Donald McLachlan wrote:
>
>> 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 YUV4MPEG2http://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.
>
> If you store a 4K resolution file uncompressed you're likely to hit 
> your disk speed as a bottleneck. If the source is 4096×3112, 
> that's 12,746,752 pixels, since you're likely using yuv420p 
> that 19,120,128 bytes per frame. At 29.97 that's 4.2694 Gb per second. 
> Most hard drives can't output data that fast.

Not a problem for our RAID array. Worst case sequential read speed is 
916 MB/sec = 7.328 Gb per second :-)

    crc-fsmanager:/usr/local/src/iozone3_398/src/current # ./iozone -a
    -s 36G -i 0 -i 1 -f /sage/junk
         Iozone: Performance Test of File I/O
                 Version $Revision: 3.398 $
             Compiled for 64 bit mode.
             Build: linux

         Contributors:William Norcott, Don Capps, Isom Crawford, Kirby
    Collins
                      Al Slater, Scott Rhine, Mike Wisner, Ken Goss
                      Steve Landherr, Brad Smith, Mark Kelly, Dr. Alain
    CYR,
                      Randy Dunlap, Mark Montague, Dan Million, Gavin
    Brebner,
                      Jean-Marc Zucconi, Jeff Blomberg, Benny Halevy,
    Dave Boone,
                      Erik Habbinga, Kris Strecker, Walter Wong, Joshua
    Root,
                      Fabrice Bacchella, Zhenghua Xue, Qin Li, Darren
    Sawyer.
                      Ben England.

         Run began: Fri Dec 16 10:21:25 2011

         Auto Mode
         File size set to 37748736 KB
         Command line used: ./iozone -a -s 36G -i 0 -i 1 -f /sage/junk
         Output is in Kbytes/sec
         Time Resolution = 0.000001 seconds.
         Processor cache size set to 1024 Kbytes.
         Processor cache line size set to 32 bytes.
         File stride size set to 17 * record size.
                                                                 random 
    random    bkwd   record   stride
                   KB  reclen   write rewrite    read    reread   
    read   write    read  rewrite     read   fwrite frewrite   fread 
    freread
             37748736       4 1646784 1751053  1623316  1612042
             37748736       8 1957188 2119167  1639095  1607022
             37748736      16 2264275 2363946  1592283  1579286
             37748736      32 2356344 2520561  1553067  1543598
             37748736      64 2505691 2592686  1489351  1477467
             37748736     128 2518238 2604410  1391418  1381205
             37748736     256 2504904 2586447   938562   933364
             37748736     512 2528407 2595810   940123   951379
             37748736    1024 2517605 2580054   960786   955005
             37748736    2048 2505202 2592549   932404   933584
             37748736    4096 2419229 2464026   929779   940346
             37748736    8192 2155905 2212610   923048   917926
             37748736   16384 2120693 2153394   922434   916141



>
>> I had checked -pix_fmts and -codecs, but I did not know to check 
>> -formats.
>
> Try ffmpeg -formats.
> Dave Rice

Now I know I'll check that next time.

Thanks again,
Don

>
>> 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