LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-01-2017, 07:47 AM   #1
elsmandino
Member
 
Registered: Oct 2009
Posts: 103

Rep: Reputation: 0
Advice on editing .ts files


I have a mixture of SD and HD movies that I have recorded over the years.

I would really like to cut all the adverts out as well as stripping away unneeded audiotracks (like the narrative that is often provided for those with poor eyesight). To preserve the subtitles would be great, but I could live with losing that if absolutely necessary.

What program do you recommend?

Also, what container should I use? Should I leave the output as .ts or perhaps repackage the output in something like mp4 or mkv?
 
Old 08-01-2017, 08:26 AM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,150

Rep: Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264Reputation: 1264
I believe ffmpeg will handle ts files.
 
Old 08-01-2017, 08:38 AM   #3
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,146
Blog Entries: 6

Rep: Reputation: 1833Reputation: 1833Reputation: 1833Reputation: 1833Reputation: 1833Reputation: 1833Reputation: 1833Reputation: 1833Reputation: 1833Reputation: 1833Reputation: 1833
The first thing I do when working with .ts (transport stream) files is to run it through ffmpeg and put a file header on it with a working time index.
Code:
ffmpeg -i file.ts -c:a copy -c:v copy file.mp4
Then you can edit file.mp4 any way that you wish. If you for examples want to edit out the commercials.
Made up Examples:

Get video from 3:00 to 8:34 in the video
Code:
ffmpeg -ss 00:03:00 -t 00:05:34 -i file.mp4 -c:a copy -c:v copy out1.mp4
10:00 to 20:26
Code:
ffmpeg -ss 00:10:00 -t 00:10:26 -i file.mp4 -c:a copy -c:v copy out2.mp4
22:00 to 30:38
Code:
ffmpeg -ss 00:22:00 -t 00:08:38 -i file.mp4 -c:a copy -c:v copy out3.mp4
That will give you out1.mp4 out2.mp4 and out3.mp4

To put those together for final video:
Code:
touch file.txt
Either edit file.txt in your text editor or redirect to it

file.txt
Code:
file '/path/to/out1.mp4'
file '/path/to/out2.mp4'
file '/path/to/out3.mp4'
Code:
ffmpeg -f concat -i file.txt -c:a copy -c:v copy final.mp4
or
Code:
ffmpeg -i "concat:/path/to/out1.mp4|/path/to/out2.mp4|/path/to/out3.mp4" -c:a copy -c:v copy final.mp4
.ts steams are mpeg2 video and aac audio. If you want to reencode that to something different or smaller then you can. Look at the man page for ffmpeg.
You will want the -c:a and -c:v switches.

if you want more, ask.
 
1 members found this post helpful.
Old 08-01-2017, 10:11 AM   #4
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
ive used xvidenc/h264enc.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Need some advice on parsing and editing a text file MojoRising Linux - General 4 09-20-2006 03:48 AM
audio editing advice please solusrex Linux - Software 10 07-14-2005 03:51 AM
Need advice on editing mdb files bruno buys Linux - Software 1 03-28-2005 05:52 PM
Advice request, cropping or editing midi's The Bad Penny Linux - Software 2 07-25-2004 11:50 AM
Need advice on FASTEST distro for video editing? Jedman Linux - Newbie 2 04-04-2002 05:29 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:44 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration