Questions tagged [nv12-nv21]

Use for questions relating to the NV12 and NV21 YUV formats. Also known as YCbCr.

NV12 and NV21

NV12 and NV21 are standards for YUV420 elements ordering.

libyuv description:

NV12 is a biplanar format with a full sized Y plane followed by a single chroma plane with weaved U and V values. NV21 is the same but with weaved V and U values. The 12 in NV12 refers to 12 bits per pixel. NV12 has a half width and half height chroma channel, and therefore is a 420 subsampling.

In context of NV12/NV21, YUV format is mainly referred to as YCbCr.

NV12 and NV21 are detailed by FOURCC standard:

VideoLAN description: NV12/NV21

Microsoft description: NV12

NV12 element ordering example (each element is one byte): YYYYYY
YYYYYY
UVUVUV

NV12

NV21 element ordering example:
YYYYYY
YYYYYY
VUVUVU

33 questions
1
vote
1 answer

How does FFMPEG 4.4 convert NV12 format to YUV420 on Windows?

I want to use FFmpeg to convert the input NV12 format to YUV420P. I tried to use sws_scale conversion, but the colors are all green. I have successfully converted YUYV422 to 420P using sws, but FAILED to convert NV12 to YUV420. What should I…
NecroDriver
  • 13
  • 1
  • 4
1
vote
2 answers

Converting RGB8 to to NV12 with libav/ffmpeg

I am trying to convert an input RGB8 image into NV12 using libav, but sws_scale raises a reading access violation. I must have the planes or the stride wrong, but I can't see why. At this point I believe I'd benefit from a fresh pair of eyes. What…
Xavi
  • 43
  • 2
1
vote
1 answer

Convert RAW images to BMP format

I received a .raw frame format (here is a sample) which contains the raw pixel values of a frame. And I've been told I can convert it to an image (.bmp or .png) using FFMpeg using following command. However, when trying, it doesn't work. dd bs=16…
Tina J
  • 4,983
  • 13
  • 59
  • 125
1
vote
0 answers

How to convert single texture from RGBA to NV12 using Direct3D 12?

There is an useless D3D12 sample code project on github https://github.com/microsoft/D3D12TranslationLayer The step stuck at CreateVideoProcessor ID3D12Device1* device1= {}; ID3D12VideoDevice* videodevice = {}; ID3D12VideoProcessor* VideoProcessor…
Sidney Niu
  • 31
  • 4
1
vote
2 answers

Nvidia NVDEC - copy decoded frame to D3D11 NV12 texture

I'm trying to copy the NV12 NVDEC decoded buffer directly into an NV12 d3d11 texture. No luck so far. What I've managed to do is a double shot copy using 2 d3d11 textures (luma + chroma), 2 cuGraphicsMapResources, 2…
Fabio
  • 77
  • 6
1
vote
0 answers

Copy NV12 to ID3D11Texture2D at once

I have a decoder which produces NV12 yuv frames. What I would like to do is to copy that frame to ID3D11Texture2D texture with single memcpy. Because D3D11_MAPPED_SUBRESOURCE has a different RowPitch than my NV12 frame has I have to copy whole yuv…
Teamol
  • 733
  • 1
  • 14
  • 42
1
vote
0 answers

Image Magick: how to convert png file into raw NV21 and NV12

Is it possible to convert png image using Image Magick into raw NV21 or NV12 formart ? I do the following: convert test_color.png -size 1024x768 -depth 8 -colorspace Rec601YCbCr yuv:image.bin The converted image is YV12 according to the…
Bill Lumbert
  • 4,633
  • 3
  • 20
  • 30
1
vote
1 answer

Confusion regarding the image format NV21 and the different memory layouts it seems to have

I have to deal with images in the format given above. However, I have found conflicting information about it. According to another stack overflow answer the UV values follow eachother, while according to Wikipedia the V values lie AFTER the U values…
Noobs DeSroobs
  • 253
  • 1
  • 6
  • 24
0
votes
0 answers

How to get an image with an extension .nv12 from a .jpg image

I am working with .jpg RGB images on a linux system. How do I get .nv12 images from these? I know how to convert RGB images into YUV420 images with ffmpeg, but I don't know how to get .nv12 files from RGB images.
skinnybb
  • 89
  • 2
  • 8
0
votes
0 answers

D3D11 VideoProcessor render 1080p NV12 texture issue

I create a NV12 texture with cpu access, and use shaderResource to map Luma and Chroma, then copy decoded frame with NV12 format to it, since 1080p is 1920x1088 in buffer actually, so i dropped the bottom 8px data. // Create NV12Texture bool…
Grey
  • 5
  • 3
0
votes
0 answers

h265 raw file frames to jpeg conversion using gstreamer

h265 raw files not decoding to image format from RTSP stream I want to store each raw frame from rtsp stream and copy this file to another system and decode that frames from H265 to jpeg. because I have three client systems with low configuration so…
0
votes
0 answers

iOS screen capture RPBroadcastSampleHandler callbacks some bad video frames (yuv nv12) when the screen fps is high?

I'm working on screen capturing and recording on iOS, it's based on the ReplayKit and RPBroadcastSampleHandler, the video and audio frame was callback in processSampleBuffer:withType:. it results good if the screen was still, but when it moves,…
0
votes
1 answer

Why is chrominance lost when i copy DXGI_FORMAT_NV12 ID3D11Texture from a d3d11device to a d3d11on12device?

D3D11_TEXTURE2D_DESC texture_desc = {0}; texture_desc.Width = 640; texture_desc.Height = 480; texture_desc.MipLevels = 1; texture_desc.Format = DXGI_FORMAT_NV12; texture_desc.SampleDesc.Count = 1; texture_desc.ArraySize = 1; texture_desc.Usage =…
Logoro
  • 1
  • 1
0
votes
1 answer

How to hardware decode a h265 video, lower resolution and fps and pass on as raw video in yuv420 format

The following ffmpeg command decodes a h265 rtsp video stream in hardware using qsv, lowers resolution from 4k to 1080p, fps from 20 to 5 and tries to save the video as rawvideo using the pix_fmt yuv420p. ffmpeg -hide_banner -loglevel warning…
brujoand
  • 815
  • 8
  • 15
0
votes
1 answer

nv12 to rgb opengl render issue

I'm trying to render a camera nv12 buffer to OpenGL ES surface in C++ and here is the output. Let's look to my shaders: const char gVertexShader[] = "#version 320 es\n" "layout (location = 0) in vec4 vertex;\n" "out vec2 TexCoords;\n" …
X6Entrepreneur
  • 971
  • 2
  • 10
  • 30