LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   How to convert .ts files to mkv or avi (https://www.linuxquestions.org/questions/linux-software-2/how-to-convert-ts-files-to-mkv-or-avi-630251/)

Pearlseattle 03-24-2008 10:44 AM

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!
:scratch:

aus9 03-24-2008 07:30 PM

see if this helps?
http://www.togaware.com/linux/surviv...Transport.html

Pearlseattle 03-25-2008 12:49 PM

Thank you! Let me have a look...

Pearlseattle 03-26-2008 12:26 PM

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!!! :D


All times are GMT -5. The time now is 04:53 AM.