I am a very lazy guy so the method below can be better optimized, shortened. I ll post something new when make it with Python instead, it will be much more better as Ill try to handle all possible errors. To use FFMPEG you need to have it in your system, you can setup similar to how you setup Java. I scrolled through this video it seems like it explains well, so you can follow
this if you need guidance in setting up FFMPEG.
My Folders structure
"Downloads"
>> "TS to MP4"
>>
"ts files"
and
"ts to mp4"
Right now with this, I use two bat files, The download folder contains another folder named "TS to MP4", within that folder are two subfolders, "ts files" and "ts to mp4".
The first bat file (optional) copies only the ts files from download folder to the "ts files" folder in "TS to Mp4" folder(in downloads). Once thats done, the second bat file converts all the ts files to mp4 format and copies it to the "ts to mp4" folder in the "TS to Mp4" folder( in Downloads folder).
The original ts files remain in the ts files folder, which I delete manually. [Once I make this in Python I will make all checks for any possible errors, check if all files conversions are successful or not and delete all original ts files with successful conversion] This is just a something I wanted quick cos I was tired of using the command in prompt and editing the command for each file...yikess.
I use downloads folder(any folder is fine).
(OPTIONAL) first bat file [
to copy only ts files from a folder to another folder] : Open notepad and paste below code in the pad, save notepad with any name but with .bat extension.....if you see below there are two path addresses, first one is the original path for ts files folder and second path leads where to copy paste those ts files, so change the path according to your system, dont leave out the
\*.ts* in the end of first path
Code:
move "E:\downloads\*.ts*" "E:\downloads\TS to mp4\ts files"
pause
(Convertion) second bat file [
to convert all the ts files to mp4] : Same with this, open notepad and paste below code, save with any name but with .bat extension, two paths again in this, first path is where the ts files are located and second where to paste the new converted file, so make the folder path changes in this as per your system. Dont leave out the
%%~nxi.mp4 in the end of second path.
Code:
[USER=52473]@echo[/USER] off
setlocal enableDelayedExpansion
cd "E:\downloads\TS to mp4\ts files\"
for /r %%i in (*.ts) do (
echo %%i
ffmpeg -y -i "%%i" -c copy "E:\downloads\TS to mp4\ts to mp4\%%~nxi.mp4"
)
endlocal
pause
You can change to any other formats than mp4 as per your needs, just check if its supported in ffmpeg or not, if it is then just add your format in the end instead of .mp4.