-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvideo resampler.bat
42 lines (38 loc) · 1.99 KB
/
video resampler.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
:: This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
:: This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
:: You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
:: Copyright 2023 Thqrn. Licensed under the GNU General Public License v3.0.
:: @froest on Discord
:: https://github.com/Thqrn/ffmpeg-scripts
:: resample a video using tmix
@echo off
if "1%~1" == "1" (
echo no input
echo use send to or run the file with a parameter
pause
exit
)
ffprobe -v error -select_streams v:0 -show_entries stream=r_frame_rate -i %1 -of csv=p=0 > %temp%\fps.txt
set /p infps=<%temp%\fps.txt
if exist "%temp%\fps.txt" (del "%temp%\fps.txt")
set /a infps=%infps%
set /p "outfps=output fps: "
set /p "bluramount=blur amount (default is 1.0): "
echo [N]VENC
echo [C]PU
echo [A]MF
echo [Q]uicksync
choice /c NCAQ /n /m "Select an encoder: "
set ch=%errorlevel%
if %ch% == 1 set encodingargs=-c:v h264_nvenc -preset p7 -rc vbr -b:v 250M -cq 14
if %ch% == 2 set encodingargs=-c:v libx264 -preset slow -crf 17 -aq-mode 3
if %ch% == 3 set encodingargs=-c:v h264_amf -quality quality -qp_i 16 -qp_p 18 -qp_b 22
if %ch% == 4 set encodingargs=-c:v h264_qsv -preset veryslow -global_quality:v 15
set tmixframes=((%infps%*%bluramount%)/%outfps%)
ffmpeg -loglevel warning -stats -i %1 ^
-vf tmix=frames=%tmixframes%:weights="1",fps=%outfps% ^
%encodingargs% ^
-c:a copy "%~dpn1 (resampled %infpsoriginal% to %outfps%).mp4"
where /q ffplay || exit
if not exist "C:\Windows\Media\notify.wav" (exit) else ffplay "C:\Windows\Media\notify.wav" -volume 50 -autoexit -showmode 0 -loglevel quiet
exit