Save video in H265 format

The following command works ok for me

gst-launch-1.0 -ev rtspsrc location=rtsp://127.0.0.1:8554/test ! application/x-rtp, media=video, encoding-name=H264 ! queue ! rtph264depay ! h264parse ! nvv4l2decoder ! nvvidconv ! ‘video/x-raw(memory:NVMM),width=640,height=480’ ! nvv4l2h264enc ! h264parse ! matroskamux ! filesink location=received_h264.mkv

It reads from an H264 encoded rtsp stream and saves to a file using the same format after downscaling to 640x480.

Is it possible to write the video using H265 instead of H264? If yes, then how should I modify the command?

Hi,
Please try

gst-launch-1.0 -ev rtspsrc location=rtsp://127.0.0.1:8554/test ! application/x-rtp, media=video, encoding-name=H264 ! queue ! rtph264depay ! h264parse ! nvv4l2decoder ! nvvidconv ! ‘video/x-raw(memory:NVMM),width=640,height=480’ ! nvv4l2h265enc ! h265parse ! matroskamux ! filesink location=received_h265.mkv

1 Like

It worked, thanks. But the video is of exactly the same size. I expected a smaller size compared to H264 format.

Hi,
The bitrate will meet the configured value and psnr is better in h265. Please run the commands and do comparison:
H264 vs H265 - #4 by DaneLLL

Thanks for the answers, they are really helpful.

Is there sth I could do to reduce the size? Lower the bitrate perhaps? But how can I do sth like this?

Hi,
It should work by setting bitrate to a smaller value. Default value is 4Mbps and can try 1Mbps for 480p30.

Thanks,

can you please also tell me how should I modify the gstreamer pipeline to achieve the new bitrate?

Hi,
Please try

gst-launch-1.0 -ev rtspsrc location=rtsp://127.0.0.1:8554/test ! application/x-rtp, media=video, encoding-name=H264 ! queue ! rtph264depay ! h264parse ! nvv4l2decoder ! nvvidconv ! ‘video/x-raw(memory:NVMM),width=640,height=480’ ! nvv4l2h265enc bitrate=1000000 ! h265parse ! matroskamux ! filesink location=received_h265.mkv

The command lists all encoder properties:

gst-inspect-1.0 nvv4l2h265enc

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.