简体   繁体   中英

How to convert cctv footage to h265 for streaming and recording in nginx-rtmp module?

I am using the nginx-rtmp-module here to pull an rtsp stream from a camera on local network and convert it to rtmp . This rtmp stream is then converted to hls and made available for livestreaming. It is also being recorded in 5 min segments. (these things can all be seen in the nginx.conf below).

I want to change the video codec to h265 to save storage space, since each 5 min video is ~230mb , and using opencv and python , I was able to get <100mb per 5 min video using h265 , so I know there is a lot of space for storage saving.

How can I change the codec of the stream to h265 ?

I have tried installing libx265-dev and setting -vcodec libx265 , however this tells me flv is an invalid container and I'm getting nowhere with finding a valid container for streaming + recording.

My nginx.conf :

rtmp {
    server {
        listen 1935; # Listen on standard RTMP port

        application relay {
            
            live on;

            hls on;
            hls_path /tmp/hls;
            hls_fragment 15s;


            exec_static /usr/bin/ffmpeg -i rtsp://test:test@192.168.100.10:8554/fhd -vcodec copy -f flv rtmp://localhost:1935/relay/fhd; 

            # record block  
            record video;
            record_path /tmp/hls;
            record_unique on;
            record_interval 5m;
        }
    }
}

The RTMP protocol does not have support for the h.265 codec. There is no standard way to do this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM