File conversion between Y4M and Raw YUV format

It’s easy to convert between the two formats as long as you have a fairly recent release of MJPEGTools package installed. Here are the examples on Fedora 21:

  • Suppose we have a raw YUV file named BasketballDrill_832x480_50.yuv. This file is one of the HEVC test sequences in 4:2:0 planar format. The display aspect ratio (DAR) should be 16:9. Following is the command line to convert it to Y4M format:

    $cat BasketballDrill_832x480_50.yuv | yuv4mpeg -w 832 -h 480 -x 420mpeg2 -a 40:39 -i p -r 50:1 > BasketballDrill.y4m

    Note that we specify the pixel aspect ratio (PAR), rather than DAR, in the command line.

  • Once the Y4M file is created, we can use the following command line to view the file:

    $yuvplay < BasketballDrill.y4m

  • In the case that we need to strip a Y4M file down to a raw YUV file so we can feed it to an encoder that does not accept Y4M as input, we can use the following command line:

    $y4mtoyuv < BasketballDrill.y4m > BasketballDrill.yuv

For more information, refer to the man pages of the package.

Advertisements

About jadecolour

One of the seven billion on this planet.
此条目发表在Computer分类目录。将固定链接加入收藏夹。

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s