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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
|
01-15-2014, 11:36 PM
|
#1
|
Member
Registered: Jun 2009
Location: Philippines
Distribution: Fedora 36; Homebrew desktop with Ryzen 5600G and 32Gb. Using Red Hat since 1998
Posts: 304
Rep:
|
Media newbie: How do I stitch together multiple .ts files into a single video?
I have a digital TV recorder. It saves recordings in a directory named for the show I am recording e.g. 'ABC1-01012014-2210-ABC News Late Edition.pvr', as a sequence of .ts files e.g. 'data0001.ts' , 'data0002.ts', 'data0003.ts' and a text file called 'MM_PLAY_TIME.ini'.
A web search indicated that .ts files are MPEG2 Transport Stream files and can be converted to MPEG2 Program Stream (.ps) files, for better interoperability with a wide range of players.
I can play all the .ts files, sequentially, on my Fedora 19 box, using VLC Media Player, but is there a way to stitch them together into a single file, so I can see the whole program without interruption?
If I can get that far, I believe a tool like avidemux will allow me to convert the file to .ps - does that sound right?
Any help would be appreciated.
|
|
|
01-16-2014, 03:15 PM
|
#2
|
Senior Member
Registered: May 2010
Location: Planet Earth
Distribution: Debian
Posts: 1,030
|
There is a video editor for GNU/Linux, Openshot, with that you may be able to merge the videos. It is probably available in Fedora repositories.
Regards
Last edited by ukiuki; 01-16-2014 at 03:19 PM.
|
|
|
01-17-2014, 03:51 PM
|
#3
|
Member
Registered: Jun 2009
Location: Philippines
Distribution: Fedora 36; Homebrew desktop with Ryzen 5600G and 32Gb. Using Red Hat since 1998
Posts: 304
Original Poster
Rep:
|
Thanks ukiuki. I will explore Openshot and see what it can do.
|
|
|
01-17-2014, 04:28 PM
|
#4
|
Senior Member
Registered: Dec 2013
Distribution: Slackware
Posts: 1,982
|
I would think concatenating them with 'cat' might work. No harm in trying, just output to a different file.
|
|
|
01-18-2014, 12:28 AM
|
#5
|
Member
Registered: Jun 2009
Location: Philippines
Distribution: Fedora 36; Homebrew desktop with Ryzen 5600G and 32Gb. Using Red Hat since 1998
Posts: 304
Original Poster
Rep:
|
Thanks, metaschima. Unfortunately, each of the first three files is 2.1Gb, so cat tries to create a humungous file, which does not work on my 32 bit platform. I only know, because I tried and it went 'bang' <grin>.
|
|
|
01-18-2014, 01:15 AM
|
#6
|
Member
Registered: Jun 2009
Location: Philippines
Distribution: Fedora 36; Homebrew desktop with Ryzen 5600G and 32Gb. Using Red Hat since 1998
Posts: 304
Original Poster
Rep:
|
Hmmmm .... I was wrong about the file size issue. I used avidemux, which opened the first file in the sequence and noticed the rest were sequentially numbered, so offered to open them all. I did this, set the output format to 'Mpeg-PS Muxer(ff)' and chose to 'Save', which asked for a target filename, then happily created a 6.5Gb file out of it. I have yet to play the file, so cannot assert everything went well, but the indications so far are good.
If the new file plays nicely, I will try using Openshot, to trim the opening and closing extra few minutes I recorded, to make sure I captured the whole movie. So far, so good.
|
|
|
01-18-2014, 01:29 AM
|
#7
|
Member
Registered: Oct 2012
Location: Tucson, AZ
Distribution: Debian/CentOS
Posts: 124
Rep:
|
In Linux a simple "cat file2.ts >> file1.ts" will add file2.ts to the end of file1.ts.
|
|
|
01-18-2014, 02:26 AM
|
#8
|
Member
Registered: Jun 2009
Location: Philippines
Distribution: Fedora 36; Homebrew desktop with Ryzen 5600G and 32Gb. Using Red Hat since 1998
Posts: 304
Original Poster
Rep:
|
Well, OpenShot just died when I tried to play the file, so I used avidemux to trim the unwanted parts and ended up with a three-hour movie, which is what I wanted.
Thanks all for your help
|
|
|
01-19-2014, 09:49 PM
|
#9
|
Member
Registered: Jun 2009
Location: Philippines
Distribution: Fedora 36; Homebrew desktop with Ryzen 5600G and 32Gb. Using Red Hat since 1998
Posts: 304
Original Poster
Rep:
|
Sequel:
The movie I eneded up with was a 5.8Gb file. To shrink it to fit a DVD, I used ffmpeg and specified a lower bit rate per second. As this was going to be a shrunk file, I told ffmpeg to output to 'shrunk.mpg'. When I was sure it was small enough (4.7Gb), I checked that Brasero would accept it for writing to a DVD. Brasero was happy with 'shrunk.mpg', but when I renamed the file to '<real movie name>.mpg', Braseo reported the error "<real movie name.mpg> is not suitable for audio or video media". I renamed it back to 'shrunk.mpg' and Brasero was happy again, so it seems Brasero checks the content of the file, to ensure some internal identifier matches the filename. Weird, to a newbie, but glad it is solved.
For the sake of anyone following this thread, the ffmpeg command line I used, to shrink a 5.8Gb file at 4150 kbits per second, to a 4.7Gb file, was:
ffmpeg -i <big filename>.mpg -c:v mpeg2video -b:v 3200k shrunk.mpg
Incidentally, I first tried limiting the file size by using the file size limit option to ffmpeg as '-fs 4700MiB', but this option was ignored, which is why I had to play around with the bit rate, until I ended up with an output file small enough to burn to DVD. Of course, I may have used incorrect syntax for this option, but I checked that it follows what the man page said. Also, first attempts had ffmpeg convert the output to mpeg1video, which is why I had to specify mpeg2video for the video stream. Curious.
|
|
1 members found this post helpful.
|
01-25-2015, 02:08 AM
|
#10
|
LQ Newbie
Registered: May 2013
Posts: 6
Rep: 
|
Quote:
Originally Posted by RootMason
In Linux a simple "cat file2.ts >> file1.ts" will add file2.ts to the end of file1.ts.
|
This guy right here has the answer. No crazy software needed.
cat file1.ts file2.ts file3.ts file4.ts > full_video.ts
Done.
|
|
|
01-26-2015, 06:43 PM
|
#11
|
Member
Registered: Jun 2009
Location: Philippines
Distribution: Fedora 36; Homebrew desktop with Ryzen 5600G and 32Gb. Using Red Hat since 1998
Posts: 304
Original Poster
Rep:
|
Quote:
Originally Posted by CaptSaltyJack
cat file1.ts file2.ts file3.ts file4.ts > full_video.ts
|
Thanks CaptSaltyJack. I was unsure if video files contained any wrappers or similar to specify their start and end points, in which case a simple cat might have resulted in unreadable output. I'm glad to have it clarified. "8-)
|
|
|
01-27-2015, 04:49 PM
|
#12
|
Member
Registered: Dec 2014
Distribution: Linux Mint 17.*
Posts: 326
Rep: 
|
Quote:
Originally Posted by Doug Hutcheson
Thanks CaptSaltyJack. I was unsure if video files contained any wrappers or similar to specify their start and end points, in which case a simple cat might have resulted in unreadable output. I'm glad to have it clarified. "8-)
|
Actually, this is often a concern. It will likely work, but you won't be able to seek, files will play far past their limit (cat 2 30sec files together and you get a clip that says it's 30 sec long but plays for 60 sec)
This is with files that aren't intended to be split or combined (eg mp4, ogg, mp3)
If your files were split after being encoded, the below doesn't apply.
I would consider cat the quick & dirty fix - since it works, but I would suggest using ffmpeg to put them together is you want it to look nice
Here's a guide.
https://trac.ffmpeg.org/wiki/Concatenate
Last edited by Miati; 01-27-2015 at 04:55 PM.
|
|
|
01-27-2015, 04:51 PM
|
#13
|
LQ Newbie
Registered: May 2013
Posts: 6
Rep: 
|
Strange, I used the cat method to concatenate 500 separate TS files together, then load into Adobe Premiere to export as MP4. Worked totally fine. Maybe I got lucky.
Will use ffmpeg next time, thanks for the tip!
|
|
|
01-27-2015, 05:04 PM
|
#14
|
Member
Registered: Dec 2014
Distribution: Linux Mint 17.*
Posts: 326
Rep: 
|
Quote:
Originally Posted by CaptSaltyJack
Strange, I used the cat method to concatenate 500 separate TS files together, then load into Adobe Premiere to export as MP4. Worked totally fine. Maybe I got lucky. 
|
It's important to consider when / why it's being split or combined.
I'm not familiar with .ts files, but if they are simply a sequential organized parts of a file with the first containing all info needed, concatenating them is fine (& the right thing to do)
On the other hand, concatenating a ogg file with another will likely make it work until the first song ends - then do something (good or bad)
Then using ffmpeg to re-write the correct info is the right thing to do in that scenario.
From the OP, it looks like they were mpeg2 files, so I would go with ffmpeg.
However, if a simple cat did it & there's no issues with seek or anything - go with it (it's easier).
|
|
|
01-27-2015, 05:07 PM
|
#15
|
LQ Newbie
Registered: May 2013
Posts: 6
Rep: 
|
TS = MPEG2 parts.
Any seek issues would've been eliminated when I converted it to H.264 MP4, I would think?
|
|
|
All times are GMT -5. The time now is 04:53 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|