SQ6QV script for Jetson

From BATC Wiki
Jump to navigation Jump to search
#!/bin/bash
set -x
v4l2-ctl --set-ctrl=focus_auto=1
#v4l2-ctl --set-ctrl=focus_auto=0
#v4l2-ctl --set-ctrl=focus_absolute=25
#v4l2-ctl --set-ctrl=exposure_absolute=500
v4l2-ctl --set-ctrl=exposure_auto_priority=1
v4l2-ctl --set-ctrl=backlight_compensation=0
v4l2-ctl --set-fmt-video=width=320,height=240
#v4l2-ctl --set-fmt-video=width=640,height=480
#v4l2-ctl --set-fmt-video=width=800,height=600


CALL=SQ6QV

#35k 8psk 3/4
BITRATE_TS="76500"
AUDIO_BITRATE="24k"
VIDEO_BITRATE="10k"

PCR_PTS=1200000


#FFMPEG_OUTPUT="udp://127.0.0.1:2244\?pkt_size=1316\&bitrate=$BITRATE_TS"
FFMPEG_OUTPUT="udp://127.0.0.1:2244\?pkt_size=1316"
#FFMPEG_OUTPUT=udp://192.168.10.198:2222\?pkt_size=1316

OUT_META=-mpegts_original_network_id 1 -mpegts_transport_stream_id 1 -mpegts_service_id 1 -mpegts_pmt_start_pid 4096 -streamid 0:256 -streamid 1:257 -metadata service_provider="SQ6QV" -metadata service_name="SQ6QV Tom"

AUDIO_CODEC="-af highpass=f=250,lowpass=f=3000 -acodec aac -aac_coder twoloop -aac_pns disable -ar 11025 -ac 1 -bufsize:a $AUDIO_BITRATE -b:a $AUDIO_BITRATE"

#VIDEO_CODEC="-vcodec hevc_nvmpi  -pix_fmt yuv420p -s 1920x1080 -bufsize:v $VIDEO_BITRATE -b:v $VIDEO_BITRATE"
#VIDEO_CODEC="-avoid_negative_ts 1 -max_delay $PCR_PTS -vcodec h264_nvmpi -g 500 -r 15  -pix_fmt yuv420p -rc cbr -bufsize:v $VIDEO_BITRATE -b:v $VIDEO_BITRATE"
VIDEO_CODEC="-avoid_negative_ts 1 -max_delay $PCR_PTS -vcodec hevc_nvmpi -g 450 -r 3 -preset slow -pix_fmt yuv420p -rc cbr -bufsize:v $VIDEO_BITRATE -b:v $VIDEO_BITRATE"


VIDEO_SRC="-f v4l2 -i /dev/video0"
AUDIO_SRC="-f alsa -i hw:2 -ac 1 -ar 11025"

/home/matt/jetff/jetson-ffmpeg/build/ffmpeg/ffmpeg $VIDEO_SRC $AUDIO_SRC -f mpegts $VIDEO_CODEC $AUDIO_CODEC -muxrate $BITRATE_TS $OUT_META $FFMPEG_OUTPUT