Skip to content

Instantly share code, notes, and snippets.

@smooker
Created November 9, 2022 09:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smooker/fe91d2d974c4c7d2c928f3ed64a7d81c to your computer and use it in GitHub Desktop.
Save smooker/fe91d2d974c4c7d2c928f3ed64a7d81c to your computer and use it in GitHub Desktop.
rtsp-simple-server transcode
# General options
# sets the verbosity of the program; available values are "warn", "info", "debug".
logLevel: info
# destinations of log messages; available values are "stdout", "file" and "syslog".
logDestinations: [stdout]
# if "file" is in logDestinations, this is the file which will receive the logs.
logFile: rtsp-simple-server.log
# timeout of read operations.
readTimeout: 10s
# timeout of write operations.
writeTimeout: 10s
#protocols: [tcp]
protocols: [udp, multicast, tcp]
readBufferCount: 64
#readBufferSize: 2048
###############################################
# HLS parameters
# disable support for the HLS protocol.
hlsDisable: yes
# address of the HLS listener.
hlsAddress: :8888
# by default, HLS is generated only when requested by a user.
# this option allows to generate it always, avoiding the delay between request and generation.
hlsAlwaysRemux: no
# number of HLS segments to generate.
# increasing segments allows more buffering,
# decreasing segments decreases latency.
hlsSegmentCount: 3
# minimum duration of each segment.
# the final segment duration is also influenced by the interval between IDR frames,
# since the server changes the segment duration to include at least a IDR frame in each one.
hlsSegmentDuration: 16s
# Maximum size of each segment.
# This prevents RAM exhaustion.
hlsSegmentMaxSize: 50M
# value of the Access-Control-Allow-Origin header provided in every HTTP response.
# This allows to play the HLS stream from an external website.
hlsAllowOrigin: '*'
###############################################
paths:
tv1:
readUser: user
readPass: userpass
# runOnDemand: ffmpeg -y -vsync 0 -threads:v 2 -threads:a 8 -filter_threads 2 -thread_queue_size 64 -hwaccel cuda -hwaccel_output_format cuda -extra_hw_frames 16 -f v4l2 -input_format mjpeg -video_size 1920x1080 -framerate 25 -extra_hw_frames 16 -i /dev/video0 -f pulse -i default -bsf:a aac_adtstoasc -c:a aac -ac 2 -b:a 128k -c:v h264_nvenc -b:v 10M -f rtsp -rtsp_transport tcp rtsp://localhost:$RTSP_PORT/tv1
# runOnDemandRestart: yes
# runOnDemandStartTimeout: 20s
# runOnDemandCloseAfter: 20s
# runOnInit: ffmpeg -re -y -vsync 1 -threads:v 8 -threads:a 8 -filter_threads 8 -thread_queue_size 64 -hwaccel cuda -hwaccel_output_format cuda -extra_hw_frames 16 -f v4l2 -input_format mjpeg -video_size 1920x1080 -framerate 25 -extra_hw_frames 16 -i /dev/video0 -f pulse -i default -bsf:a aac_adtstoasc -c:a aac -ac 2 -b:a 128k -c:v h264_nvenc -b:v 10M -f rtsp -rtsp_transport tcp rtsp://localhost:$RTSP_PORT/tv1
runOnDemand: ffmpeg -re -y -vsync 1 -threads:v 8 -threads:a 8 -filter_threads 8 -thread_queue_size 64 -hwaccel cuda -hwaccel_output_format cuda -extra_hw_frames 16 -f v4l2 -input_format mjpeg -video_size 1920x1080 -framerate 25 -extra_hw_frames 16 -i /dev/video0 -f pulse -i default -bsf:a aac_adtstoasc -c:a aac -ac 2 -b:a 128k -c:v hevc_nvenc -b:v 2M -f rtsp -rtsp_transport tcp rtsp://localhost:$RTSP_PORT/tv1
# runOnInitRestart: yes
tv1_h264:
readUser: user
readPass: userpass
# runOnDemand: ffmpeg -y -vsync 0 -threads:v 2 -threads:a 8 -filter_threads 2 -thread_queue_size 64 -hwaccel cuda -hwaccel_output_format cuda -extra_hw_frames 16 -f v4l2 -input_format mjpeg -video_size 1920x1080 -framerate 25 -extra_hw_frames 16 -i /dev/video0 -f pulse -i default -bsf:a aac_adtstoasc -c:a aac -ac 2 -b:a 128k -c:v h264_nvenc -b:v 10M -f rtsp -rtsp_transport tcp rtsp://localhost:$RTSP_PORT/tv1
# runOnDemandRestart: yes
# runOnDemandStartTimeout: 20s
# runOnDemandCloseAfter: 20s
# runOnInit: ffmpeg -re -y -vsync 1 -threads:v 8 -threads:a 8 -filter_threads 8 -thread_queue_size 64 -hwaccel cuda -hwaccel_output_format cuda -extra_hw_frames 16 -f v4l2 -input_format mjpeg -video_size 1920x1080 -framerate 25 -extra_hw_frames 16 -i /dev/video0 -f pulse -i default -bsf:a aac_adtstoasc -c:a aac -ac 2 -b:a 128k -c:v h264_nvenc -b:v 10M -f rtsp -rtsp_transport tcp rtsp://localhost:$RTSP_PORT/tv1
runOnDemand: ffmpeg -re -y -vsync 1 -threads:v 8 -threads:a 8 -filter_threads 8 -thread_queue_size 64 -hwaccel cuda -hwaccel_output_format cuda -extra_hw_frames 16 -extra_hw_frames 16 -i rtsp://user:userpass@localhost:8554/tv1 -c:v h264_nvenc -b:v 2M -f rtsp -rtsp_transport tcp rtsp://localhost:$RTSP_PORT/tv1_h264
cam1:
readUser: user
readPass: userpass
source: rtsp://user:userpass@10.11.0.20:8554/cam1
sourceProtocol: udp
cam2:
readUser: user
readPass: userpass
source: rtsp://user:userpass@10.11.0.20:8554/cam2
sourceProtocol: udp
cam4:
readUser: user
readPass: userpass
source: rtsp://user:userpass@10.11.0.20:8554/cam4
sourceProtocol: udp
cam5:
readUser: user
readPass: userpass
source: rtsp://user:userpass@10.11.0.20:8554/cam5
sourceProtocol: udp
cam1_h264:
readUser: user
readPass: userpass
runOnDemand: ffmpeg -re -y -vsync 1 -threads:v 8 -threads:a 8 -filter_threads 8 -thread_queue_size 64 -hwaccel cuda -hwaccel_output_format cuda -extra_hw_frames 16 -i rtsp://user:userpass@localhost:8554/cam1 -c:v h264_nvenc -b:v 2M -f rtsp -rtsp_transport tcp rtsp://localhost:$RTSP_PORT/cam11_h264
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment