Created
August 13, 2024 19:27
-
-
Save JuniorLima/7c51d5d64e7f69e84e2929377136026d to your computer and use it in GitHub Desktop.
Script .bat para Cortar Vídeo com CPU
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
REM Nome do arquivo de configuração | |
set config_file=config.txt | |
REM Verificar se o arquivo de configuração existe | |
if not exist %config_file% ( | |
echo O arquivo de configuracao %config_file% nao foi encontrado. | |
pause | |
exit /b | |
) | |
REM Ler o nome do arquivo de vídeo da primeira linha do arquivo de configuração | |
set /p video=<%config_file% | |
REM Contador para os segmentos cortados | |
set count=1 | |
REM Habilitar o uso de variáveis com "delayed expansion" | |
setlocal enabledelayedexpansion | |
REM Ler cada linha subsequente para obter os tempos de corte | |
for /f "skip=1 tokens=1,2" %%a in (%config_file%) do ( | |
set start_time=%%a | |
set end_time=%%b | |
echo Cortando o video de !start_time! ate !end_time!... | |
REM Usar a CPU para cortar o vídeo sem recodificação | |
ffmpeg -i "%video%" -ss !start_time! -to !end_time! -c copy output_cortado_!count!.mp4 | |
set /a count+=1 | |
) | |
REM Desabilitar o uso de variáveis com "delayed expansion" | |
endlocal | |
REM Pausar o terminal para mostrar o resultado | |
pause |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cortar_juntar.bat |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
REM Mudar para o diretório onde os vídeos estão localizados | |
cd /d "C:\Users\webju\Videos\juntar" | |
REM Criar o arquivo input.txt | |
if exist input.txt del input.txt | |
for %%i in (*.mp4) do echo file '%%i' >> input.txt | |
REM Executar o FFmpeg para juntar os vídeos | |
ffmpeg -f concat -safe 0 -i input.txt -c copy output.mp4 | |
REM Limpar o arquivo input.txt | |
del input.txt | |
REM Pausar o terminal para mostrar o resultado | |
pause |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment