H264 vs H265

Hello Guys!

Just a quick question on this. I saw that H265 is able to reduce bandwidth and storage as compared to H264 of about 50% given same bitrate and pipeline. However, when I run the pipeline, I realized that they are about the same with no significant decrease in bandwidth and filesize. Am I doing it right? Below are the pipeline I used.

RTSP Both constant at about 1Mbps upload on network

./test-launch "nvarguscamerasrc ! video/x-raw(memory:NVMM), width=3264, height=2464, framerate=20/1 ! nvvidconv ! nvv4l2h265enc control-rate=1 bitrate=8000000 !  rtph265pay name=pay0 pt=96 config-interval=1"


./test-launch "nvarguscamerasrc ! video/x-raw(memory:NVMM), width=3264, height=2464, framerate=20/1 ! nvvidconv ! nvv4l2h264enc control-rate=1 bitrate=8000000 ! rtph264pay name=pay0 pt=96 config-interval=1"

Filesink Both file size is about 13MB for about 10 seconds of recording

gst-launch-1.0 nvarguscamerasrc ! 'video/x-raw(memory:NVMM), width=3264, height=2464, framerate=20/1' ! nvv4l2h265enc control-rate=1 bitrate=8000000 ! h265parse ! qtmux ! filesink location=filename_h265.mp4 -e


gst-launch-1.0 nvarguscamerasrc ! 'video/x-raw(memory:NVMM), width=3264, height=2464, framerate=20/1' ! nvv4l2h264enc control-rate=1 bitrate=8000000 ! h264parse ! qtmux ! filesink location=filename_h264.mp4 -e

Hope that you guys can help me out! Thanks!

8Mbps is strict for 3264x2464p20, suggest you try higher bitrate such as 14Mbps.

Hi @DaneLLL,

Ive change the bitrate to 14000000 and also 30000000. Both H264 and H265 are streaming at the same rate. There are no significant decrease for H265.

For comparing h264 and h265, please use same YUV source and compare PSNR.
For example, you may download the source:

$ gst-launch-1.0 filesrc location= park_joy_1080p50.y4m ! y4mdec ! nvvidconv ! nvv4l2h264enc bitrate=14000000 control-rate=1 vbv-size=450000 ! h264parse ! qtmux ! filesink location= park_joy.mov
$ gst-launch-1.0 filesrc location= park_joy_1080p50.y4m ! y4mdec ! nvvidconv ! nvv4l2h265enc bitrate=14000000 control-rate=1 vbv-size=450000 ! h265parse ! qtmux ! filesink location= park_joy_265.mov

And install/run ffmpeg to check PSNR

$ gst-launch-1.0 filesrc location= park_joy_1080p50.y4m ! y4mdec ! filesink location=park_joy_50.yuv
$ sudo apt install ffmpeg
$ ffmpeg -i park_joy.mov -f rawvideo -video_size 1920x1080 -framerate 50 -i park_joy_50.yuv -lavfi "ssim;[0:v][1:v]psnr" -f null -       ffmpeg version 3.4.6-0ubuntu0.18.04.1 Copyright (c) 2000-2019 the FFmpeg developers
[Parsed_ssim_0 @ 0x55c102f010] SSIM Y:0.713943 (5.435473) U:0.732030 (5.719138) V:0.788833 (6.753741) All:0.729439 (5.677350)
[Parsed_psnr_1 @ 0x55c102eda0] PSNR y:24.882475 u:30.801891 v:34.448052 average:26.262739 min:22.971376 max:30.380294

Hi @DaneLLL, How about RTSP streaming? Im trying to achieve a significant drop in my network bandwidth utilisation with the help of h265. But currently, both are at the same rate. Thanks!

It is ~0.6dB difference in quality when comaparing in same 14Mbps. A slight improvement. So for keeping in same quality, bitrate also does not differ a lot. You may set a lower bitrate and configure

> preset-level        : HW preset level for encoder
                        flags: readable, writable, changeable only in NULL or READY state
                        Enum "GstV4L2VideoEncHwPreset" Default: 1, "UltraFastPreset"
                           (0): DisablePreset    - Disable HW-Preset
                           (1): UltraFastPreset  - UltraFastPreset for high perf
                           (2): FastPreset       - FastPreset
                           (3): MediumPreset     - MediumPreset
                           (4): SlowPreset       - SlowPreset

See if you can balance quality, bitrate, and performance by adjusting the properties.

Hi DaneLLL, managed to get it by using omx instead. The difference is by half. But on nvv4l2, I guess the codec has already been tuned. Another question is that if jetson nano can support 16MP camera module for usb3.0 and if there will be any performance issues. Thanks!

The maximum resolution verified is 4K and max width of encoder is 4096. We would like to suggest use 4K as maximum.

Hi DaneLLL, thanks for the response. Also, have you tried videocapture opencv python flask with h265? Or it is not possible to do so?

There are posts about using cv2.VideoWriter:

However, we would suggest this solution:


Hi DaneLLL, thanks but can opencv stream to browser an encoded live capture? Also, when I’m running tensorflow example, my cpu usage peak. I’m suspecting it’s python that’s causing the high utilization as tensorflow, keras are using Gpu instead. Am I right to say so? Thanks!


Not sure about this. May need forum users to share suggestion.

You may run sudo tegrastats to confirm whether it runs on CPU or GPU.
Besides, we have DeepStream SDK for doing deep learning inference.
You may install it through SDKManager and try.