I’m trying to understand how to correctly set-up parameters in a gstreamer pipeline. I want to perform some tests with videos, and encode at lossless and near-lossless rates.
The gstreamer pipeline I used for lossless was:
gst-launch-1.0 filesrc location=input.raw ! 'video/x-raw, width=(int)1440, height=(int)1080, framerate=(fraction)60/1' ! rawvideoparse width=1440 height=1080 format=gray8 framerate=60 ! nvvidconv ! omxh264enc control-rate=0 qp-range=0,1:0,1:0,1 quant-i-frames=0 quant-p-frames=0 MeasureEncoderLatency=true ! avimux ! filesink location=out.avi
I’m not sure how to modify the parameters in omxh264enc to get near-lossless quality (~80% of original quality). Could someone please help me understand how to correctly set the quantization parameters?
Do you consider using jetson_multimedia_api? If yes, you may convert GREY to YUV444 and to encode into lossless h264 stream by running
01_video_encode. Please refer to this post:
H.264 lossless encoding - #2 by DaneLLL
For YUV420, we can only encode with qp=0 to get lowest loss. Your command looks fine. We suggest use nvv4l2h264enc since omx plugins are deprecated.
Thanks for the help. Does the multimedia API also allow encoding of raw gray video? (in Y8 or other monochrome formats)
No, GRAY format is not supported in encoding. You would need to convert to YUV420 or YUV444. It should be fine since it just fills in dummy bytes to U,V planes. Valid data is still in Y plane.
Ok thank you.
i tried the code (01_video_encode) with this pipeline:
sudo ./video_encode /home/user/codecTests/20210628_124809_video_original_cut.yuv 1440 1080 H264 test.h264 --max-perf --stats --elossless
The output was:
NvMMLiteBlockCreate : Block : BlockType = 4
H264: Profile = 244, Level = 51
NVMEDIA_ENC: bBlitMode is set to TRUE
Could not read complete frame from input file
File read complete.
Got 0 size buffer in capture
----------- Element = enc0 -----------
Total Profiling time = 5.99581
Average FPS = 70.0489
Total units processed = 421
Average latency(usec) = 133653
Minimum latency(usec) = 44592
Maximum latency(usec) = 185928
Could you please tell me what the latency at the very bottom is? Latency of what? Is it average latency to encode each frame?
The implementation is in
It profiles the time of sending frames in output plane and getting frames in capture plane. You may read the code to check how it works.
Thanks for the help. I will have a look
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.