Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed ld-chroma-ai_yc filter aspect ratio + fix for scripts finding model folder with spaces on Windows #1

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions other_script/ld-chroma-ai_yc.bat
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ set chromafile=%chromafile:"=%
set audiofile=%audiofile:"=%

title Decoding : %~n1 Decoder : %decoder% %ntsc-phase-comp% Luma-nr : %luma-nr% Chroma-nr : %chroma-nr% Chroma-gain : %chroma-gain% Chroma-phase : %chroma-phase%
ld-chroma-decoder.exe "%lumafile%" --input-json "%lumafile%.json" -f %decoder% --luma-nr %luma-nr% --chroma-nr 0 --chroma-gain 0 --chroma-phase 1 -p y4m | ffmpeg -y -hide_banner -i - -pix_fmt y8 -c:v ffv1 -coder 1 -context 0 -level 3 -slices 4 -slicecrc 0 -pass 1 "%lumafile%_bw.mkv"
ld-chroma-decoder.exe "%chromafile%" --input-json "%lumafile%.json" -f %decoder% %ntsc-phase-comp% --luma-nr 0 --chroma-nr %chroma-nr% --chroma-gain %chroma-gain% --chroma-phase %chroma-phase% -p y4m | ffmpeg -y -hide_banner -r (30000/1001) -i "%lumafile%_bw.mkv" -r (30000/1001) -i - %audiofile% -filter_complex "[0]format=pix_fmts=yuv444p,extractplanes=y[y]; [1]format=pix_fmts=yuv444p,extractplanes=u+v[u][v]; [y][u][v]mergeplanes=0x001020:yuv444p,format=pix_fmts=yuv444p" -r (30000/1001) -top 1 -c:v ffv1 -coder 1 -context 0 -level 3 -slices 4 -slicecrc 0 -pass 1 -c:a flac -compression_level 11 "%lumafile%.mkv"
ld-chroma-decoder.exe "%lumafile%" --input-json "%lumafile%.json" -f %decoder% --luma-nr %luma-nr% --chroma-nr 0 --chroma-gain 0 --chroma-phase 1 -p y4m | ffmpeg -y -hide_banner -i - -pix_fmt y8 -c:v ffv1 -top 1 -aspect 4:3 -coder 1 -context 1 -level 3 -slices 24 -slicecrc 1 -g 1 -pass 1 "%lumafile%_bw.mkv"
ld-chroma-decoder.exe "%chromafile%" --input-json "%lumafile%.json" -f %decoder% %ntsc-phase-comp% --luma-nr 0 --chroma-nr %chroma-nr% --chroma-gain %chroma-gain% --chroma-phase %chroma-phase% -p y4m | ffmpeg -y -hide_banner -r (30000/1001) -i "%lumafile%_bw.mkv" -r (30000/1001) -i - %audiofile% -filter_complex "[0]setsar=ratio=4/3,format=pix_fmts=yuv444p,extractplanes=y[y]; [1]setsar=ratio=4/3,format=pix_fmts=yuv444p,extractplanes=u+v[u][v]; [y][u][v]mergeplanes=0x001020:yuv444p,format=pix_fmts=yuv444p,setsar=ratio=4/3,setdar=ratio=4/3,setfield=tff" -r (30000/1001) -c:v ffv1 -coder 1 -context 1 -level 3 -slices 24 -slicecrc 1 -g 1 -pass 1 -c:a flac -compression_level 12 "%lumafile%.mkv"
echo end of the script
pause
2 changes: 1 addition & 1 deletion script/windows/ai_decode_ntsc_file.bat
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
%~d0
cd %~dp0
cd ../../
ffmpeg -thread_queue_size 4096 -hide_banner -loglevel error -f rawvideo -video_size 910x263 -pix_fmt gray16 -i "%~dp1%~n1.tbc" -vf crop=910:242:0:20 -c:v rawvideo -f rawvideo - | "cvbs_ai_decode.exe" -m %CD%/model/ntsc_1d -t 4 | ffmpeg -thread_queue_size 4096 -hide_banner -y -f rawvideo -r (30000/1001) -video_size 792x484 -pix_fmt rgb48 -i - -filter_complex "extractplanes=r+g+b[Ry][Gu][Bv];[Ry][Gu][Bv]mergeplanes=0x001020:yuv444p16,format=yuv422p,il=l=i:c=i:a=i,setdar=4/3,crop=760:484:16:0" -c:v ffv1 -coder 1 -context 0 -level 3 -slices 4 -slicecrc 0 -pass 1 -top 1 "%~dp1%~n1_aidecode.mkv"
ffmpeg -thread_queue_size 4096 -hide_banner -loglevel error -f rawvideo -video_size 910x263 -pix_fmt gray16 -i "%~dp1%~n1.tbc" -vf crop=910:242:0:20 -c:v rawvideo -f rawvideo - | "cvbs_ai_decode.exe" -m "%CD%/model/ntsc_1d" -t 4 | ffmpeg -thread_queue_size 4096 -hide_banner -y -f rawvideo -r (30000/1001) -video_size 792x484 -pix_fmt rgb48 -i - -filter_complex "extractplanes=r+g+b[Ry][Gu][Bv];[Ry][Gu][Bv]mergeplanes=0x001020:yuv444p16,format=yuv422p,il=l=i:c=i:a=i,setdar=4/3,crop=760:484:16:0" -c:v ffv1 -coder 1 -context 0 -level 3 -slices 4 -slicecrc 0 -pass 1 -top 1 "%~dp1%~n1_aidecode.mkv"
pause
2 changes: 1 addition & 1 deletion script/windows/ai_decode_ntsc_preview.bat
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
%~d0
cd %~dp0
cd ../../
ffmpeg -thread_queue_size 4096 -hide_banner -loglevel error -f rawvideo -video_size 910x263 -pix_fmt gray16 -i "%~dp1%~n1.tbc" -vf crop=910:242:0:20 -c:v rawvideo -f rawvideo - | "cvbs_ai_decode.exe" -m %CD%/model/ntsc_decode -t 4 | ffmpeg -thread_queue_size 4096 -hide_banner -loglevel error -f rawvideo -r (30000/1001) -video_size 792x484 -pix_fmt rgb48 -i - -filter_complex "extractplanes=r+g+b[Ry][Gu][Bv];[Ry][Gu][Bv]mergeplanes=0x001020:yuv444p16,format=yuv444p16,il=l=i:c=i:a=i,setdar=4/3" -f nut -c:v rawvideo - | ffplay -hide_banner -i - -vf crop=760:484:16:0,w3fdif
ffmpeg -thread_queue_size 4096 -hide_banner -loglevel error -f rawvideo -video_size 910x263 -pix_fmt gray16 -i "%~dp1%~n1.tbc" -vf crop=910:242:0:20 -c:v rawvideo -f rawvideo - | "cvbs_ai_decode.exe" -m "%CD%/model/ntsc_decode" -t 4 | ffmpeg -thread_queue_size 4096 -hide_banner -loglevel error -f rawvideo -r (30000/1001) -video_size 792x484 -pix_fmt rgb48 -i - -filter_complex "extractplanes=r+g+b[Ry][Gu][Bv];[Ry][Gu][Bv]mergeplanes=0x001020:yuv444p16,format=yuv444p16,il=l=i:c=i:a=i,setdar=4/3" -f nut -c:v rawvideo - | ffplay -hide_banner -i - -vf crop=760:484:16:0,w3fdif
pause
2 changes: 1 addition & 1 deletion script/windows/ai_decode_ntsc_tbc_file.bat
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
%~d0
cd %~dp0
cd ../../
ffmpeg -thread_queue_size 4096 -hide_banner -loglevel error -f rawvideo -video_size 910x263 -pix_fmt gray16 -i "%~dp1%~n1.tbc" -vf crop=910:242:0:20 -c:v rawvideo -f rawvideo - | "cvbs_ai_decode.exe" -m %CD%/model/ntsc_decode -o tbc -t 4 | ffmpeg -thread_queue_size 4096 -hide_banner -y -f rawvideo -pix_fmt y16 -video_size 910x242 -r (30000/1001)*2 -i - -f rawvideo -video_size 910x263 -pix_fmt gray16 -r (30000/1001)*2 -i "%~dp1%~n1.tbc" -filter_complex "[1][0]overlay=0:20" -pix_fmt y16 -f rawvideo -c:v rawvideo "%~dp1%~n1_aitbc.tbc"
ffmpeg -thread_queue_size 4096 -hide_banner -loglevel error -f rawvideo -video_size 910x263 -pix_fmt gray16 -i "%~dp1%~n1.tbc" -vf crop=910:242:0:20 -c:v rawvideo -f rawvideo - | "cvbs_ai_decode.exe" -m "%CD%/model/ntsc_decode" -o tbc -t 4 | ffmpeg -thread_queue_size 4096 -hide_banner -y -f rawvideo -pix_fmt y16 -video_size 910x242 -r (30000/1001)*2 -i - -f rawvideo -video_size 910x263 -pix_fmt gray16 -r (30000/1001)*2 -i "%~dp1%~n1.tbc" -filter_complex "[1][0]overlay=0:20" -pix_fmt y16 -f rawvideo -c:v rawvideo "%~dp1%~n1_aitbc.tbc"
echo copy of the json file
copy "%~dp1%~n1.tbc.json" "%~dp1%~n1_aitbc.tbc.json"
pause
2 changes: 1 addition & 1 deletion script/windows/ai_decode_ntsc_yc_file.bat
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
cd %~dp0
cd ../../
echo YC separation :
ffmpeg -thread_queue_size 4096 -hide_banner -loglevel error -f rawvideo -video_size 910x263 -pix_fmt gray16 -i "%~dp1%~n1.tbc" -vf crop=910:242:0:20 -c:v rawvideo -f rawvideo - | "cvbs_ai_decode.exe" -m %CD%/model/ntsc_yc -o yc -t 4 | ffmpeg -thread_queue_size 4096 -hide_banner -loglevel error -y -f rawvideo -r (30000/1001)*2 -video_size 2x191664 -pix_fmt y16 -i - -filter_complex "split[i0][i1];[i0]crop=1:191664:0:0[y];[i1]crop=1:191664:1:0[c];[c]split[c1][c2];[y][c1]vstack[yc];[yc][c2]vstack" -pix_fmt y16 -f rawvideo -c:v rawvideo - | ffmpeg -thread_queue_size 4096 -hide_banner -y -f rawvideo -pix_fmt yuv444p16 -video_size 792x242 -r (30000/1001)*2 -i - -f rawvideo -video_size 910x263 -pix_fmt gray16 -r (30000/1001)*2 -i "%~dp1%~n1.tbc" -f rawvideo -video_size 910x263 -pix_fmt gray16 -r (30000/1001)*2 -i "%~dp1%~n1.tbc" -f rawvideo -video_size 910x263 -pix_fmt gray16 -r (30000/1001)*2 -i "%~dp1%~n1.tbc" -f lavfi -r (30000/1001)*2 -i color=0x808080:910x263:d=1,format=y16 -filter_complex "[0]extractplanes=y+u[y][c];[1][y]overlay=118:20[yburst];[3]crop=2:253:72:10,scale=1x1,tmix=frames=6:weights="111111",scale=50x253[replaceburst];[yburst][replaceburst]overlay=74:10[ytbc];[2]crop=50:253:74:10[burst];[4][c]overlay=118:20[cnoburst];[cnoburst][burst]overlay=74:10[ctbc]" -map [ytbc] -pix_fmt y16 -f rawvideo -c:v rawvideo "%~dp1%~n1_aiyc.tbc" -map [ctbc] -pix_fmt y16 -f rawvideo -c:v rawvideo "%~dp1%~n1_aiyc_chroma.tbc"
ffmpeg -thread_queue_size 4096 -hide_banner -loglevel error -f rawvideo -video_size 910x263 -pix_fmt gray16 -i "%~dp1%~n1.tbc" -vf crop=910:242:0:20 -c:v rawvideo -f rawvideo - | "cvbs_ai_decode.exe" -m "%CD%/model/ntsc_yc" -o yc -t 4 | ffmpeg -thread_queue_size 4096 -hide_banner -loglevel error -y -f rawvideo -r (30000/1001)*2 -video_size 2x191664 -pix_fmt y16 -i - -filter_complex "split[i0][i1];[i0]crop=1:191664:0:0[y];[i1]crop=1:191664:1:0[c];[c]split[c1][c2];[y][c1]vstack[yc];[yc][c2]vstack" -pix_fmt y16 -f rawvideo -c:v rawvideo - | ffmpeg -thread_queue_size 4096 -hide_banner -y -f rawvideo -pix_fmt yuv444p16 -video_size 792x242 -r (30000/1001)*2 -i - -f rawvideo -video_size 910x263 -pix_fmt gray16 -r (30000/1001)*2 -i "%~dp1%~n1.tbc" -f rawvideo -video_size 910x263 -pix_fmt gray16 -r (30000/1001)*2 -i "%~dp1%~n1.tbc" -f rawvideo -video_size 910x263 -pix_fmt gray16 -r (30000/1001)*2 -i "%~dp1%~n1.tbc" -f lavfi -r (30000/1001)*2 -i color=0x808080:910x263:d=1,format=y16 -filter_complex "[0]extractplanes=y+u[y][c];[1][y]overlay=118:20[yburst];[3]crop=2:253:72:10,scale=1x1,tmix=frames=6:weights="111111",scale=50x253[replaceburst];[yburst][replaceburst]overlay=74:10[ytbc];[2]crop=50:253:74:10[burst];[4][c]overlay=118:20[cnoburst];[cnoburst][burst]overlay=74:10[ctbc]" -map [ytbc] -pix_fmt y16 -f rawvideo -c:v rawvideo "%~dp1%~n1_aiyc.tbc" -map [ctbc] -pix_fmt y16 -f rawvideo -c:v rawvideo "%~dp1%~n1_aiyc_chroma.tbc"
echo copy of the json file
copy "%~dp1%~n1.tbc.json" "%~dp1%~n1_aiyc.tbc.json"
pause