Search This Blog

2020-11-24

PowerShell: Merge TS Video as MP4 Video

Product: Windows Command Prompt, FFMPEG

This post is to show using ffmpeg.exe utility (free) that bundled with Stream, or freely download from Internet to combine multi-part TS video as 1 mp4 video

The steps:

1. Create a text file which contains list of TS video file
2. Feed above file into ffmpeg as input file
3. Specify "copy" in ffmpeg to copy the video 
4. Specify audio format conversion from MPEG-2 or MPEG-4 AAC ADTS to MPEG-4 LATM
5. Assumes that I have a TS video for a video for Season 1, Episode 8, and their filename format is S01E[nnn] where nnn is the part number
6. Set the output filename as "Expense" plus episode number, in this case, 08

Command:

1. Start CMD as regular user

2. Create following as create_video.cmd in location where the TS video files are located

set n=08

(for %%i in (S01E*.ts) do @echo file '%%i') > S01E%n%_List.txt

REM ..\ffmpeg -f concat -safe 0 -i S01E%n%_List.txt -c copy Expense_S01E%n%.ts

..\ffmpeg -f concat -i S01E%n%_List.txt -c copy  -bsf:a aac_adtstoasc Expense_S01E%n%.mp4

3. Run "create_video.cmd"

No comments: