LinuxQuestions.org
Visit Jeremy's Blog.
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 09-24-2008, 01:49 PM   #1
kromberg
Member
 
Registered: Feb 2007
Location: Colorado
Distribution: FC6, FC7 x86_64
Posts: 218

Rep: Reputation: 30
MTS Video Conversion


Is there any good software that will convert the MTS or AVCHD format to any other usable formats?

Keith
 
Old 09-24-2008, 03:54 PM   #2
almatic
Member
 
Registered: Mar 2007
Distribution: Debian
Posts: 547

Rep: Reputation: 67
ffmpeg will do it. I usually convert them into dv/pal since hd format is too big for my monitor and dv will be accepted by all video editors. Use somthing like this :

ffmpeg -i input.mts -f avi -vcodec dvvideo -s pal -aspect 4:3 -qscale 4 -acodec pcm_s16le -ac 2 output.avi
 
1 members found this post helpful.
Old 09-24-2008, 06:32 PM   #3
kromberg
Member
 
Registered: Feb 2007
Location: Colorado
Distribution: FC6, FC7 x86_64
Posts: 218

Original Poster
Rep: Reputation: 30
Hmmm... that seems to cause ffmpeg from freshrpms for FC7_i386 to seg fault. I think I will play around with ffmpeg and some other possible settings.....

Keith
 
Old 09-24-2008, 06:41 PM   #4
almatic
Member
 
Registered: Mar 2007
Distribution: Debian
Posts: 547

Rep: Reputation: 67
can you play the .mts video with ffplay ?
 
Old 09-25-2008, 09:58 AM   #5
kromberg
Member
 
Registered: Feb 2007
Location: Colorado
Distribution: FC6, FC7 x86_64
Posts: 218

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by almatic View Post
can you play the .mts video with ffplay ?
No. It is very grainy and slow.

Keith
 
Old 09-25-2008, 01:37 PM   #6
almatic
Member
 
Registered: Mar 2007
Distribution: Debian
Posts: 547

Rep: Reputation: 67
and what program do you use to watch these files ? Are you using a 64bit system ? If yes you should first make sure that the codecs work correctly for 64bit (in this case h264 and ac3 probably).
 
Old 10-06-2008, 06:15 PM   #7
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 4,137
Blog Entries: 1

Rep: Reputation: 873Reputation: 873Reputation: 873Reputation: 873Reputation: 873Reputation: 873Reputation: 873
vlc seems to be the best for playing these for me. Although stuck at about 25% speed to see every frame without dropping frames and such. On my 2GHz laptop.

As far as conversion. mencoder seems to start spewing junk video wise after two or three minutes of .mts footage. ffmpeg is the only one I've gotten to transcribe the video completely. And ffmpeg is the only one to extract the audio. mplayer does a coredump when trying to extract the audio. vlc was either doing just audio, or just video depending on the compile options (swscale?) and version(0.8.6 / 0.9.3) for me. mencoder does alright for the first minute plus though. It's just that past a certain point, it starts creating content that more closely resembles a screen saver than the source video. Although it functions right with most formats other than .mts/60i video.

ffmpeg -i 00000.mts -r 60000/1001 -an -f mp4 -vcodec mpeg4 -r 30000/1001 00000.mp4
ffmpeg -i 00000.mts -vn 00000.wav

The only problem I seem to have is when rejoining them, the default 25 fps of ffmpeg is causing sync issues with 30fps content. It's truncating at the end of the audio, which is still a few frames shy of what should have been 60i / 60 fps content converted to 30 fps content. At least several seconds worth on a five minute clip.

The below seems to work on shorter clips. When going from 24Mbps AVCHD / 60i to other formats. But still suffers on longer clips. And the initial couple of frames seem to be plagued with artifacts which aren't in the original.

mencoder -of mpeg -mpegopts muxrate=36000 -mc 0 -oac lavc -fps 60000/1001 -ofps 30000/1001 -ovc lavc -lavcopts vcodec=mpeg4:mbd=2:mv0:trell:v4mv:cbp:last_pred=3redia=2:dia=2:vmax_b_frames=2:vb_strategy=1recm p=2:cmp=2:subcmp=2reme=2:qns=2:vbitrate=36000 -vf scale=1280:720 ./00000.mts -o 00000.mpeg

or

ffmpeg -i 00000.mp4 -i 00000.wav -sameq -s hd720 -r 30000/1001 00000.mpg

to rejoin the previous extractions. Although it doesn't seem to ever complete for me. Using mencoder to rejoin the converted video and separate audio seems to be the only workable fps compensation method. At least on longer clips. So use 00000.mp4 -audiofile 00000.wav -o 00000.mpeg at the end of the mencoder line above to put the parts back together. For some reason -oac copy hangs about the 4th frame, -oac lavc bypasses that.

Still mostly greek to me, I'm an audio guy. But I'm working on getting an HD camcorder, and learned the above while trying to work with some samples I gathered from the target cam at best buy. Needless to say, not quite as painless as I'd hoped. And ffmpeg seems to be the only one interested in keeping the original quality IMO. Not that mencoder isn't capable, it's just that it tends to make most of my attempts to scale my HD content look like YouTube quality.
 
Old 10-06-2008, 06:21 PM   #8
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 4,137
Blog Entries: 1

Rep: Reputation: 873Reputation: 873Reputation: 873Reputation: 873Reputation: 873Reputation: 873Reputation: 873
silly emoticons. replace faces with colon plus lower case p.

Last edited by Shadow_7; 10-06-2008 at 06:23 PM.
 
Old 10-07-2008, 01:50 AM   #9
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 4,137
Blog Entries: 1

Rep: Reputation: 873Reputation: 873Reputation: 873Reputation: 873Reputation: 873Reputation: 873Reputation: 873
If everything worked as it should you could probably use:

ffmpeg -i 00000.mts -sameq -target ntsc-dvd 00000.mpeg

But I seem to have issues with that, so here's my script of sorts.

#!/bin/bash

if [ ! $1 ] || [ ! $2 ] || [ ! $3 ] || [ ! $4 ]; then
echo "USAGE: Input_MTS_File Output_MP4_File Output_WAV_File Output_MPEG_File"
exit 1
fi

INFILE=$1
MP4FILE=$2
WAVFILE=$3
MPEGFILE=$4

echo $INFILE $MP4FILE $WAVFILE $MPEGFILE

file $INFILE >> convert.log
date +%F-%H:%M:%S:%N >> convert.log

# export video ONLY to an MP4 file
ffmpeg -i $INFILE -r 60000/1001 -sameq -f mp4 -vcodec mpeg4 -an -r 30000/1001 $MP4FILE

file $MP4FILE >> convert.log
date +%F-%H:%M:%S:%N >> convert.log

# export audio ONLY to a WAV file
ffmpeg -i $INFILE -vn $WAVFILE

file $WAVFILE >> convert.log
date +%F-%H:%M:%S:%N >> convert.log

# merge the MP4 file and WAV file while converting 60fps to 30fps.
# NOTE: tried to do that in the first step (-r 60000/1001), but it didn't work apparently.
mencoder -of mpeg -mpegopts muxrate=36000 -mc 0 \
-fps 60000/1001 -ofps 30000/1001 -ovc lavc \
-lavcopts vcodec=mpeg4:mbd=2:mv0:trell:v4mv:cbp:last_pred=3redia=2:dia=2:vmax_b_frames=2:vb_strategy=1recm p=2:cmp=2:subcmp=2reme=2:qns=2:vbitrate=6000 \
-vf scale=1280:720 -oac lavc \
-audiofile $WAVFILE $MP4FILE -o $MPEGFILE

file $MPEGFILE >> convert.log
date +%F-%H:%M:%S:%N >> convert.log

# END #

The mencoder line could probably be improved. The results are decent, but it's in essence skipping every other frame 60i. Which I attempted to correct in the initial ffmpeg line, but failed. And I'm probably missing some key frames or something as the initial two seconds of footage ends up with artifacts. And if you fast forward, or jump around in the video, it takes a bit to get back to normal. And it's quite wasteful space wise. The interim MP4 file is nearly 4x's the size of the originating MTS file. Not to mention taking forever to run. Roughly 6x's+ what it took to record on the camcorder, to convert and scale it on a 2GHz laptop. But using mencoder on the original MTS file results in artifact overdrive after the first two minutes or so. Using ffmpeg on the original MTS converts 60 fps to 30 fps without dropping any frames. Thus the video becomes twice as long and half as fast as the audio. The funny faces will probably be : plus p on the mencoder stuff. I haven't figured out how, or if emoticons can turned off on this forum.

I needed to get at a minimum the x264 stuff from videolan.org. And recompile ffmpeg / mplayer / and friends to include/support that lib. On debian stable, although debian-multimedia.org probably overcomes that need. Ultimately I want/need to use external audio on my clips. So some steps in the above could probably be combined to lower space / time / cpu usage. Or not. The above script works for me for now. YMMV.
 
Old 10-07-2008, 09:30 AM   #10
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 4,137
Blog Entries: 1

Rep: Reputation: 873Reputation: 873Reputation: 873Reputation: 873Reputation: 873Reputation: 873Reputation: 873
Taking a clue from the linux journals ffmpeg magic article / youtube clip.

ffmpeg -i 00000.mts -sameq -an -f yuv4mpegpipe - | yuvfps -s 60000:1001 -r 60000:1001 | ffmpeg -f yuv4mpegpipe -sameq -i - -sameq -s 1280x720 -f mpeg2video -r 60000/1001 video_only.mpeg

Success for keeping 60fps. Success for keeping quality. Success for taking care of scaling and saving a lot of HDD space in step 1. And surprisingly processing time is greatly reduced, while maintaining quality. Although I'm not quite sure about audio sync yet. And not exactly something that most people can retype from memory. And you still need to extract audio, and remerge it. But that can be done with ffmpeg now since it's not going to assume that your 60i content is 30p (no mater how you try to tell it otherwise). And watching 60fps content at 60fps (assuming CPU power to do so) looks light years better in terms of motion / motion stutter.
 
Old 08-30-2009, 01:33 PM   #11
DBabo
Member
 
Registered: Feb 2003
Distribution: Fedora {latest}
Posts: 552

Rep: Reputation: 40
Shadow, any luck to get everything ( video and audio) in one shot ?
 
Old 03-04-2011, 02:40 AM   #12
oudinmelanie09
LQ Newbie
 
Registered: Jun 2010
Posts: 2

Rep: Reputation: 0
FFMPEG seems to be quite professional and it is a hard work for newbee like me.

And now I found a software named Aunsoft MTS Converter for Mac which is a nice assisstant for new comers like me. I always use it to convert MTS files from Panasonic TM700 to ProRes for editing in FCP.

http://www.aunsoft.com/mts-converter-mac/

Enjoy your video
 
Old 02-27-2014, 04:40 AM   #13
Tameka R Henderson
LQ Newbie
 
Registered: Feb 2014
Location: Canton
Distribution: PTGTPT
Posts: 2

Rep: Reputation: Disabled
m2ts video converter

Wow, I was looking for exactly this piece of software to help me figure out my oly form, thanks for sharing.
I would recommend you also try m2ts video converter which is free to download trial software.
http://www.freem2tsconverter.com/
 
  


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
Video Conversion Question Agentvenom Linux - Software 6 10-07-2005 03:19 AM
video conversion software veritas Linux - Software 2 01-07-2005 12:02 AM
MTS and Linux dhammika Programming 0 12-18-2003 06:02 AM
Video conversion software jayakrishnan Linux - Software 3 11-27-2003 12:12 AM
Video conversion question. PLEASE HELP gbrad Linux - Software 4 04-19-2003 09:47 AM

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

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