LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 07-27-2006, 03:33 AM   #1
darthfoolish
Member
 
Registered: May 2006
Posts: 52

Rep: Reputation: 15
Transcoding MPEG-TS to MPEG-PS


I have a working MythTV installation, and I would like to transcode my recordings from MPEG-TS to some kind of high ratio codec probably MPEG4, maybe h264, for archiving purposes. I would like to write a script to do this automatically for recordings that meet certain criteria, and make it a cron job.

I looked at transcode, but it doesn't seem to be able to handle transport streams.

So I was looking for a way to convert transport streams to program streams first, before feeding the output to transcode.

VLC can do this, but I can't get it working properly in a script.

Say I have the following script, named xcode:

!/bin/bash
vlc --intf rc $1 --sout '#standard{mux=ps,url=$2,access=file}'

and I then say:

xcode input_stream output_stream

input_stream gets converted to a PS and saved in file $2. #2 is not getting expanded.

Does anyone know a way to do this, or alternatively another transport stream converter that is scriptable?

Or maybe even a transcoder that can do the whole lot in one step?
 
Old 07-27-2006, 03:51 AM   #2
Electro
LQ Guru
 
Registered: Jan 2002
Posts: 6,042

Rep: Reputation: Disabled
You can do it with transcode. Use mplayer as the import module. Mplayer's mencoder can work but it is not very good with audio and video sync.
 
Old 07-27-2006, 03:54 AM   #3
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,513

Rep: Reputation: 1009Reputation: 1009Reputation: 1009Reputation: 1009Reputation: 1009Reputation: 1009Reputation: 1009Reputation: 1009
Try MEncoder. I think it comes with MPlayer. MPlayer will stream to MEncoder, which will transcode to another mpeg format, I think.
 
Old 07-27-2006, 03:57 AM   #4
darthfoolish
Member
 
Registered: May 2006
Posts: 52

Original Poster
Rep: Reputation: 15
I tried this, but I couldn't get it to work using:

-x mplayer,mp3
-x mplayer
-x mencoder,mp3
-x mencoder

Here's the full command line I've been trying

transcode -i input.mpg -x mplayer,mp3 -o output.avi -y ffmpeg -F mpeg4

I get "import frame |disabled" in the output, which I think means it's not recognizing the input stream

Last edited by darthfoolish; 07-27-2006 at 04:01 AM.
 
Old 07-27-2006, 04:36 AM   #5
darthfoolish
Member
 
Registered: May 2006
Posts: 52

Original Poster
Rep: Reputation: 15
I've discovered that you have to find out the video attributes for yourself and feed them to transcode. I've done this, but it still doesn't work. Here's what I tried

transcode -H0 -i input.mpg -x mplayer,mplayer -f 25 -g 720x576 -e 48000,16,2 -o output.avi -y ffmpeg -F mpeg4

I get: critical: failed to open input source
 
Old 07-27-2006, 03:54 PM   #6
Electro
LQ Guru
 
Registered: Jan 2002
Posts: 6,042

Rep: Reputation: Disabled
The command 'transcode -H0 -i input.mpg -x mplayer,mplayer -f 25 -g 720x576 -e 48000,16,2 -o output.avi -y ffmpeg -F mpeg4' is wrong. You can not use both audio and video with mplayer. Also you did not specify the import frame rate correctly. You have to do in steps. Pick either example.

Example 1:
mencoder input.mpg -noskip -ovc frameno -oac mp3lame -lameopts cbr:br=128:mode=0 -o frameno.avi
transcode -H0 -i input.mpg -x mplayer,null -f 25,3 -g 720x576 -y ffmpeg,null -F mpeg4 -o output.avi
ffmpeg -hq -i output.avi -i input.mp3 -vcodec copy -acodec copy outputfinal.avi

Example 2:
mencoder input.mpg -noskip -ovc lavc -nosound -lavcopts vcodec=mpeg4 -ffourcc DIVX input.avi
mencoder input.mpg -noskip -ovc frameno -oac mp3lame -lameopts cbr:br=128:mode=0 -o frameno.avi
ffmpeg -hq -i output.avi -i frameno.avi -vcodec copy -acodec copy outputfinal.avi

If transcode fails, you need to make sure stream.yuv fifo file is removed before running transcode.

It is strange that MPEG-TS uses MP3 for audio. I thought it is either PCM or MPEG-2 audio. Use 'mplayer -identify -quiet -frames 0 input.mpg' to figure out the correct format because transcode always detects the audio as MP3.

I recommend using the latest version of transcode and ffmpeg. Also I recommend to compile and install transcode, ffmpeg, mplayer, and other codecs yourself. The maintainers for your distribution may not include the features during compiling.

BTW, make sure you delete frameno.avi after conversion or else mencoder will not run predictly on future conversions.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
LXer: Leading Open-Source, Open-Standard DRM Project OpenIPMP Announces New Version, Boasting Cross-Platform OMA, ISMAcryp, MPEG-2 and MPEG-4 Support LXer Syndicated Linux News 0 07-17-2006 10:33 PM
.MPEG movies Alien18 Linux - Newbie 1 06-15-2004 06:07 PM
Playing MPEG;s Genesis Linux - Software 2 06-22-2003 06:17 PM
How to convert mpeg file in mpeg-PS or TS hawkgreatelf Linux - Software 1 05-01-2003 06:09 AM
Mpeg Grumpy69 Linux - Newbie 0 08-20-2001 10:38 PM

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

All times are GMT -5. The time now is 03:57 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