LinuxQuestions.org
Help answer threads with 0 replies.
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 03-24-2008, 10:44 AM   #1
Pearlseattle
Member
 
Registered: Aug 2007
Location: Zurich, Switzerland
Distribution: Gentoo
Posts: 999

Rep: Reputation: 142Reputation: 142
How to convert .ts files to mkv or avi


Hi!
I just bought from Terratec a Cinergy C PCI HD together with the Common Interface adon and a CI-module. Unfortunately I haven't been able to make the card work under linux, even by using the experimental "mantis" kernel-module. Anyway I afterwards quickly built a small PC using all the spare parts I had lying around, installed Windows XP on it and after that I've been finally able to record TV in HD.
Now my problem is that I record the raw TV-stream (video uses h264 and sound is ac3 5 channels) as a ".ts" stream file. Using mplayer/mencoder in Linux I can watch the movie directly from the .ts-file and everything works fine, but whenever I try to transcode the contents to x264/ac3 to use a smaller video bitrate and another container (mkv), I lose audio/video sync. Whenever I jump with mplayer to e.g. +10 minutes, the video continues to play fine, but the audio starts over from the beginning of the movie.

Does somebody have a clue how I can transcode the .ts-file without losing audio/video sync?

Right now I am trying the following...
Code:
#Video 1st pass
mencoder $1 -oac copy -of rawvideo -ovc lavc -lavcopts vcodec=libx264:vbitrate=13000:vpass=1:threads=2:turbo:mbd=2:trell=yes:v4mv=yes:autoaspect:predia=2:dia=2 -o /dev/null
cp x264_2pass.log divx2pass.log
#Video 2nd pass
mencoder $1 -oac copy -of rawvideo -ovc lavc -lavcopts vcodec=libx264:vbitrate=13000:vpass=2:threads=2:mbd=2:trell=yes:v4mv=yes:autoaspect:predia=2:dia=2 -o converted_$1.video
#Audio
mplayer $1 -vo null -ao pcm:fast:file=converted_$1.audio
...and once it's done I'll somehow try to put both video and audio files into a mkv, but I'm not sure that it will work... . I'm not sure about the audio part - I know it's an ac3, but last time I tried with just a "mencoder -oac copy ...." I got again a async audio... .
Thanks!
 
Old 03-24-2008, 07:30 PM   #2
aus9
LQ 5k Club
 
Registered: Oct 2003
Location: Western Australia
Distribution: Icewm
Posts: 5,842

Rep: Reputation: Disabled
see if this helps?
http://www.togaware.com/linux/surviv...Transport.html
 
Old 03-25-2008, 12:49 PM   #3
Pearlseattle
Member
 
Registered: Aug 2007
Location: Zurich, Switzerland
Distribution: Gentoo
Posts: 999

Original Poster
Rep: Reputation: 142Reputation: 142
Thank you! Let me have a look...
 
Old 03-26-2008, 12:26 PM   #4
Pearlseattle
Member
 
Registered: Aug 2007
Location: Zurich, Switzerland
Distribution: Gentoo
Posts: 999

Original Poster
Rep: Reputation: 142Reputation: 142
Damn, it worked!!!
And it was sooo easy! I should hit myself twice on the head with a monitor for not having been able to do it without your help! TONK! TONK! Done.
I probably ran previously a very similar command but perhaps I inserted the "-of rawfile" option, that might have been the reason why I lost the sync. So, in the end now I am using:
Code:
mencoder $1 -oac copy -ovc lavc -lavcopts vcodec=libx264:vbitrate=13000:vpass=1:threads=2:turbo:mbd=2:trell=yes:v4mv=yes:autoaspect:predia=2:dia=2 -o /dev/null
cp x264_2pass.log divx2pass.log
mencoder $1 -oac copy -ovc lavc -lavcopts vcodec=libx264:vbitrate=13000:vpass=2:threads=2:mbd=2:trell=yes:v4mv=yes:autoaspect:predia=2:dia=2 -o converted_$1.avi
Well, thanks a lot!!!

Last edited by Pearlseattle; 03-26-2008 at 12:27 PM.
 
  


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
convert .mkv to .avi Gortex Linux - General 10 12-05-2017 03:19 AM
DISCUSSION: Batch convert MPEG files to AVI Steel_J LinuxAnswers Discussion 5 08-14-2013 04:40 AM
is it possible to convert avi files to BUP files? santiagosilva Linux - Desktop 5 12-20-2007 01:23 PM
Convert multiple VOB files to one AVI mrant0 Linux - Software 2 05-26-2007 12:05 PM
how do I convert an m2v files into something else (avi, mov, etc)? BrianK Linux - Software 1 10-12-2004 06:07 PM

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

All times are GMT -5. The time now is 08:50 AM.

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