Hello,
I convert .mp4 files to .ts format using this ffmpeg cmd:
ffmpeg -i video1.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts video1.ts
But obviously, it is to convert a single file. I would to adapt this command to batch convert all the mp4 of my entire folder. Can you tell me what would be the command to do so?
I already prepared a txt file ready with the list of the mp4 files, since I assume I would need it. I named it "list_mp4_to_ts.txt", and this is its content:
file 'video1.mp4'
file 'video2.mp4'
file 'video3.mp4'
Thank you!
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays! or rip iTunes movies!
+ Reply to Thread
Results 1 to 7 of 7
Thread
-
-
You don't even need a list.
Copy the code and save it to your desktop as yourname.cmd.
Select your .mp4 files and drag and drop them onto that icon on your desktop.
Code:@echo off :next if "%~1"=="" goto done ffmpeg -y -i "%~1" -c copy -bsf:v h264_mp4toannexb -f mpegts "%~1.ts" shift goto next :done
-
Great, thank you! I wasn't familiar with cmd files. And if I wanted to use a list, can you tell me what would be the command?
-
Code:
@echo off for /f "delims=" %%x in (filelist.txt) do call :encode "%%x" echo done ENDLOCAL&echo press any key to exit&pause>nul&exit :encode <video file> ffmpeg -y -i "%~1" -c copy -bsf:v h264_mp4toannexb -f mpegts "%~1.ts" goto :eof
-
did not notice you have "file " proceeding each line in your text file and removing apostrophe from both ends:
Code:@echo off for /f "delims=" %%x in (filelist.txt) do call :process "%%x" echo done ENDLOCAL&echo press any key to exit&pause>nul&exit :process <line> rem remove string: "file " from line and then removing first and last character (that apostrophe mark: ') set "path=%~1" set "path=%path:file =%" set path=%path:~1,-1% call :encode "%path%" goto :eof :encode <video file> ffmpeg -y -i "%~1" -c copy -bsf:v h264_mp4toannexb -f mpegts "%~1.ts" goto :eof
Last edited by _Al_; 12th Feb 2024 at 11:35.
-
No need to prepare any txt file. All *.mp4 in dir will be converted.
Code:@echo off dir/b *.mp4 >mp4list.txt for /F "delims=;" %%F in (mp4list.txt) do ffmpeg -i "%%F" -c copy -bsf:v h264_mp4toannexb -f mpegts "%%~dF%%~pF%%~nF.ts" del mp4list.txt pause
Last edited by rgr; 16th Feb 2024 at 12:21.
Similar Threads
-
How to batch convert/multiplex any files with ffmpeg
By Baldrick in forum User guidesReplies: 215Last Post: 1st Dec 2023, 11:38 -
Need an ffmpeg batch file to convert m4a to ac3
By DarrellS in forum AudioReplies: 7Last Post: 28th Sep 2023, 11:42 -
batch convert DTS to Ac3 using ffmpeg
By Mishari in forum Newbie / General discussionsReplies: 7Last Post: 7th Apr 2022, 16:23 -
Ffmpeg Download Batch Files
By gufoli in forum Video Streaming DownloadingReplies: 1Last Post: 26th Mar 2022, 10:22 -
Use ffmpeg to batch screenshots of many video files
By MC23 in forum Newbie / General discussionsReplies: 4Last Post: 11th May 2020, 01:57