Gabungkan semua file ts ke dalam 1 file dengan ffmpeg
@echo off
setlocal
REM Define the directory to search for .ts files
set "directory=."
REM Define the output file
set "inputfile=sorted_ts_files.txt"
REM List all .ts files, sort them, and output to the text file
dir /b "%directory%\*.ts" | sort > "%inputfile%"
REM Notify the user
echo Sorted list of .ts files has been saved to %inputfile%
REM Define the input and output files
set "inputfile=sorted_ts_files.txt"
set "concatfile=concat_list.txt"
set "outputfile=output.ts"
REM Check if the input file exists
if not exist "%inputfile%" (
echo Input file %inputfile% does not exist.
exit /b 1
)
REM Create the concat file for ffmpeg
echo Creating concat file for ffmpeg...
> "%concatfile%" (
for /f "usebackq delims=" %%a in ("%inputfile%") do echo file '%%a'
)
REM Join the video files using ffmpeg
echo Joining video files...
ffmpeg -f concat -safe 0 -i "%concatfile%" -c copy "%outputfile%"
REM Cleanup
del "%concatfile%"
del "%inputfile%"
echo Done. The output file is %outputfile%.
endlocal