SQ6QV current script

From BATC Wiki
Jump to navigation Jump to search
@echo off
set STATION=SQ6QV
set STATION_DESC=via QO-100, JO81BE Legnica, Poland
set NAME=Tomasz


rem 6639 5000 QPSK FEC 2/3 

rem 5945 5000 QPSK FEC 3/5 

rem 5315 4000 QPSK FEC 2/3 long - ??

rem 3955 4000 QPSK FEC 1/2 long - ??

rem 3986 3000 QPSK FEC 2/3 long - ??

rem 2656 2000 QPSK FEC 2/3 long - ??
 
rem 1289 1000 QPSK FEC 2/3 short - D0/D2
rem 1325 1000 QPSK FEC 2/3 long <--USE THIS
rem 1296 1000 QPSK FEC 2/3 long +pilots

rem 986  1000 QPSK FEC 1/2 long - D4

rem 1207 333 32APSK FEC 3/4 long pilots 
rem 903 250 32APSK FEC 3/4 long pilots 
rem 625 250 32APSK FEC 3/4 long pilots 
rem 451 125 32APSK FEC 3/4 long pilots use 456 640x480 

rem 861  333 16APSK FEC 2/3 long pilots - USE 859!

rem 741  333 8PSK FEC 3/4 long 
rem 726  333 8PSK FEC 3/4 long  + pilots


rem 662  500 QPSK FEC 2/3 long 

rem 995  500 QPSK FEC 2/3 long 


rem 661  333 8PSK FEC 2/3 long 

rem 646  333 8PSK FEC 2/3 long +pilots

rem 860  333 8PSK FEC 9/10 long pilots




rem 462  125 32APSK FEC 3/4 long 
rem 451  125 32APSK FEC 3/4 long +pilots

rem 442  333 QPSK FEC 2/3 long - ??

rem 240  66 32APSK FEC 3/4 long 

rem 190  66 16APSK FEC 3/4 long 

rem enter TS bitrate here:

set TS=859

set TS=%1

rem set TS=1325


set AUDIO_RATE=64

set AUDIO_SAMPLE_RATE=22050

SET OUTPUT_IP=192.168.10.208:2244
rem SET OUTPUT_IP=192.168.10.75:2244
rem SET OUTPUT_IP=127.0.0.1:2244
 
set /a TS_NO_AUDIO=%TS%-%AUDIO_RATE%
set /a VIDEO_RATE=%TS_NO_AUDIO% * 75 / 100 
set /a BUFSIZE=%VIDEO_RATE% *20 / 10 

set /a TSBITRATE=%TS% * 1000 
echo -------------------------
echo TS rate: %TS% kbit
echo Video: %VIDEO_RATE% kbit
echo Audio: %AUDIO_RATE% kbit

set /a MAX_VIDEO_RATE=VIDEO_RATE
set /a Min_VIDEO_RATE=VIDEO_RATE


rem HEIGHT -65
set TEXTY=660

set TEXTY=1030
rem set TEXTY=655
set /a TEXTYY=%TEXTY% +22
set TEXTCOL=0x33CCFFEE
set T2_SIZE=50
set DATECOL=0xFFCC00FF

set TEXT_CMD=-vf "drawtext=fontfile='hemi.ttf':text=%%{gmtime\\:%%d %%b %%Y %%X}:x=10:y=10:fontsize=%T2_SIZE%:fontcolor=%DATECOL%:shadowcolor=0x00007f9f:shadowx=2:shadowy=2, drawtext=fontfile='hemi.ttf':text='%STATION%':x=25:y=%TEXTY%:fontsize=%T2_SIZE%:fontcolor=%TEXTCOL%:shadowcolor=0x00007f9f:shadowx=2:shadowy=2, drawtext=fontfile='hemi.ttf':text='%STATION_DESC%':x=320:y=%TEXTYY%:fontsize=20:fontcolor=%TEXTCOL%:shadowcolor=0x00007f9f:shadowx=2:shadowy=2"

rem timestamps
set TEXT_CMD=-vf "drawtext=fontfile='hemi.ttf':text=%%{gmtime\\:%%X}_fr_%%{frame_num}:x=10:y=10:fontsize=100:fontcolor=%DATECOL%:shadowcolor=0x00007f9f:shadowx=2:shadowy=2, drawtext=fontfile='hemi.ttf':text='%STATION%':x=25:y=%TEXTY%:fontsize=%T2_SIZE%:fontcolor=%TEXTCOL%:shadowcolor=0x00007f9f:shadowx=2:shadowy=2, drawtext=fontfile='hemi.ttf':text='%STATION_DESC%':x=320:y=%TEXTYY%:fontsize=20:fontcolor=%TEXTCOL%:shadowcolor=0x00007f9f:shadowx=2:shadowy=2"
rem without time 
set TEXT_CMD=-vf "drawtext=fontfile='hemi.ttf':text='%STATION%':x=25:y=%TEXTY%:fontsize=%T2_SIZE%:fontcolor=%TEXTCOL%:shadowcolor=0x00007f9f:shadowx=2:shadowy=2,drawtext=fontfile='hemi.ttf':text='%STATION_DESC%':x=200:y=%TEXTYY%:fontsize=20:fontcolor=%TEXTCOL%:shadowcolor=0x00007f9f:shadowx=2:shadowy=2"
rem set TEXT_CMD=

rem 43240 udp
set OUTPUT_STREAM=-f mpegts -muxrate %TS%k  -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="%STATION%" -metadata service_name="%STATION% %NAME%" -y "udp://%OUTPUT_IP%?pkt_size=43240&bitrate=%TSBITRATE%"
set OUTPUT_STREAM=-f mpegts -muxrate %TS%k  -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="%STATION%" -metadata service_name="%STATION% %NAME%" -y "udp://%OUTPUT_IP%?pkt_size=43240"
rem 1326 udp - lower latency
rem set OUTPUT_STREAM=-f mpegts -muxrate %TS%k  -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="%STATION%" -metadata service_name="%STATION% %NAME%" -y "udp://%OUTPUT_IP%?pkt_size=1316"

rem TCP OUTPUT
rem set OUTPUT_STREAM=-f mpegts -muxrate %TS%k  -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="%STATION%" -metadata service_name="%STATION% %NAME%" -y "tcp://0.0.0.0:2244%?listen"


set VIDEO_DEVICE="vMix Video"
set AUDIO_SOURCE="vMix Audio"

rem set VIDEO_DEVICE="OBS-Camera"
rem set AUDIO_SOURCE="OBS-Audio"

set RESOLUTION=640x480
rem set RESOLUTION=730x410
rem set RESOLUTION=864x480
rem set RESOLUTION=768x480
set RESOLUTION=1280x720
rem set RESOLUTION=1920x1080

rem set RESCALE=
rem set RESCALE=-vf crop=1440:1080,scale=640:480

set FPS=-r 25
rem set FPS=


set AUDIO_PARAMS=-af "highpass=f=250,lowpass=f=6000 " -acodec aac -aac_coder twoloop -aac_pns disable -ar %AUDIO_SAMPLE_RATE% -ac 1
rem set AUDIO_PARAMS=-acodec aac -aac_coder twoloop -aac_pns disable
rem set AUDIO_PARAMS=-af "highpass=f=250, lowpass=f=4000" -acodec ac3 -ar 22050 -ac 1
rem set AUDIO_PARAMS=-af "highpass=f=250, lowpass=f=4000" -acodec mp2 -ar 22050 -ac 1
set AUDIO_PARAMS=-af highpass=f=250,lowpass=f=4000 -acodec aac -aac_coder twoloop -aac_pns disable -ar %AUDIO_SAMPLE_RATE% -ac 1
 	
rem hq
set VIDEO_CODEC=-pix_fmt yuv444p16le -vcodec hevc_nvenc -preset hq -profile:v main10 -cbr 1 -rc cbr_hq 
rem -forced-idr 1


rem BEST QUALITY
set VIDEO_CODEC=-pix_fmt yuv444p16le  -vcodec hevc_nvenc -preset slow -tune psnr -profile:v main10 -rc-lookahead 25 -spatial_aq 1 -temporal-aq 1 -vsync 0 -threads 4 -cbr 1 -rc cbr_hq -surfaces 4

set VIDEO_CODEC=-pix_fmt yuv420p  -vcodec hevc_nvenc -preset slow -tune psnr -profile:v main -rc-lookahead 35 -spatial_aq 1 -cbr 1 -rc cbr_hq -surfaces 20
rem set VIDEO_CODEC=-pix_fmt yuv420p  -vcodec hevc_nvenc -preset slow -profile:v main -rc-lookahead 35 -spatial_aq 1 -cbr 1 -rc cbr_hq -surfaces 20


rem VBR!!!
rem set VIDEO_CODEC=-pix_fmt yuv420p  -vcodec hevc_nvenc -preset slow  -profile:v main -level 4 -rc-lookahead 25 -spatial_aq 1 -temporal-aq 1 -vsync 0 -threads 4 -2pass 1 -rc cbr_hq -surfaces 10
rem set VIDEO_CODEC=-pix_fmt yuv420p  -vcodec hevc_nvenc -preset slow  -profile:v main -tune psnr -rc-lookahead 25 -spatial_aq 1 -temporal-aq 1 -threads 4 -g 250 -rc cbr_hq -surfaces 10

rem set /a MIN_VIDEO_RATE=%TS_NO_AUDIO% * 20 / 100 
rem set /a MAX_VIDEO_RATE=%TS_NO_AUDIO% * 75 / 100 

rem BEST_QUALITY_SOFTWARE -require HAL9000 :D
rem set VIDEO_CODEC=-pix_fmt yuv420p  -vcodec libx265 -preset faster -profile:v main -rc-lookahead 15 -spatial_aq 1 -temporal-aq 1 -vsync 0 -threads 4 -rc cbr_hq -surfaces 4
rem set /a MIN_VIDEO_RATE=%TS_NO_AUDIO% * 20 / 100 
rem set /a MAX_VIDEO_RATE=%TS_NO_AUDIO% * 90 / 100 



rem set VIDEO_CODEC=-vcodec h264_qsv 

rem  HQ 264
rem set VIDEO_CODEC=-pix_fmt yuv420p -vcodec nvenc_h264 -preset medium -profile:v main -rc-lookahead 25 -spatial_aq 1 -temporal-aq 1 -vsync 0 -cbr 1 -threads 4 -rc cbr_hq -forced-idr 1


rem compatible with hardware decoders
rem set VIDEO_CODEC=-pix_fmt yuv420p -vcodec hevc_nvenc -preset slow -profile:v main -rc-lookahead 15 -spatial_aq 1 -cbr 1 -rc cbr_hq -surfaces 4

rem set VIDEO_CODEC=-pix_fmt yuv420p -vcodec hevc_nvenc -preset slow -profile:v main -rc-lookahead 25 -spatial_aq 1 -cbr 1 -rc cbr_hq -surfaces 4


rem H264
rem set VIDEO_CODEC=-pix_fmt yuv420p -vcodec nvenc_h264 -preset medium -profile:v main -cbr 1 -rc cbr_hq -forced-idr 1



rem ffmpeg -f dshow -i video=%VIDEO_DEVICE% -rtbufsize 100k -f dshow -i audio=%AUDIO_SOURCE% -sample_rate %AUDIO_SAMPLE_RATE% -audio_buffer_size 100k %FILTERS% -s %RESOLUTION% -r %FPS% %VIDEO_CODEC% -b:v %VIDEO_RATE%k -minrate:v %VIDEO_RATE%k -maxrate:v %VIDEO_RATE%k -bufsize:v %BUFSIZE%k -ab %AUDIO_RATE%k %AUDIO_PARAMS% %TEXT_CMD% %OUTPUT_STREAM%
rem ffmpeg -f dshow -i video=%VIDEO_DEVICE%:audio=%AUDIO_SOURCE% -sample_rate %AUDIO_SAMPLE_RATE% -audio_buffer_size 100k %FILTERS% -s %RESOLUTION% -r %FPS% %VIDEO_CODEC% -b:v %VIDEO_RATE%k -minrate:v %VIDEO_RATE%k -maxrate:v %VIDEO_RATE%k -bufsize:v %BUFSIZE%k -ab %AUDIO_RATE%k %AUDIO_PARAMS% %TEXT_CMD% %OUTPUT_STREAM%

ffmpeg -f dshow -i video=%VIDEO_DEVICE%:audio=%AUDIO_SOURCE% -sample_rate %AUDIO_SAMPLE_RATE% -audio_buffer_size 100k %FILTERS% -s %RESOLUTION% %FPS% %RESCALE% %VIDEO_CODEC% -b:v %VIDEO_RATE%k -minrate:v %MIN_VIDEO_RATE%k -maxrate:v %MAX_VIDEO_RATE%k -bufsize:v %BUFSIZE%k -ab %AUDIO_RATE%k %AUDIO_PARAMS% %TEXT_CMD% %OUTPUT_STREAM%