Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
832 views
in Technique[技术] by (71.8m points)

h.264 - Encoding raw video into h264 using gstreamer

I am encoding raw video to h264 using nvh264enc.

The raw video is produced using dxgiscreencapsrc which has the following capabilities

video/x-raw:
         format: BGRA
          width: [ 1, 2147483647 ]
         height: [ 1, 2147483647 ]
      framerate: [ 0/1, 2147483647/1 ]

So it produces raw video in the BGRA format.

NVH264ENC does support this format for compression but also supports multiple other formats

The list of formats it supports is NV12, YV12, I420, BGRA, RGBA, Y444, VUYA.

Now I am confused as to which format is best for compressing to H264.

Should I keep it as BGRA, or should I convert the BGRA to a different format such as I420 (using gstreamer video convert) and then compressing to h264 that way.

What are the upsides/downsides of each of these raw video formats, will converting make the h264 worse better etc

question from:https://stackoverflow.com/questions/65944970/encoding-raw-video-into-h264-using-gstreamer

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Should I keep it as BGRA, or should I convert the BGRA to a different format such as I420

If the pixel format you have is supported already, just stick with that. Otherwise, you'll just waste useless CPU cycles to convert from one pixel format to another (especially given that the encoder element might be able to do it much more efficiently in the GPU).

What are the upsides/downsides of each of these raw video formats, will converting make the h264 worse better etc

There are no upsides/downsides here. All of these formats specify a way that raw video data is structured. The only caveat is if you were to use a format like NV12/YV12/I420, since those use subsampling, so this will be a lossy conversion. In general, there's a slight chance that YUV-based formats need a bit less processing (since that's what your encoder will probably use internally), but as mentioned in the previous point, you might as well let the encoder element do it for you in a more efficient way.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...