View Full Version : Need help converting avchd to mkv/mp4
idlebrain
3rd April 2011, 02:19
I am trying to write a batch script to convert AVCHD videoes produced by my panasonic hdc-tm55 camera to general purpose 1080p mp4/mkv to carry in my laptop and/or portable hard drive. So size to quality ratio is important. The AVCHD is 1080-60i. Source uploaded on mediafire.
I know how to use MeGUI, But not an expert. Also It would be easier to run the batch as the video parameters always same.
Here is what I tried with ffmpeg
c:\avtools\ffmpeg.exe -y -i %1 -acodec libfaac -ab 192k -vcodec libx264 -vpre faster -crf 24 -threads 0 %1.mp4
This created a huge file than original with 60fps. Video playback is fine. I would be fine 30 fps. Adding -r 3000/1001 resulted smaller file, but video is jerky. -deinterlace did not help.
I tried the following with the avs generated from MeGUI
c:\avtools\x264.exe --preset faster --profile main --level 4.1 --crf 24 --output %1.mp4 %1
File size is again big but smaller than ffmpeg. The video has some glittering effect.
Here is the AVS
LoadPlugin("C:\avtools\MeGUI\tools\dgavcindex\DGAVCDecode.dll")
AVCSource("C:\AVwork\tm55_squirrel.dga")
Load_Stdcall_Plugin("C:\avtools\MeGUI\tools\yadif\yadif.dll")
Yadif(order=-1)
#crop
#resize
#denoise
I gave up, and converted with FreeMake video converter (ffmpeg/x264), It generated a 25 fps video, But the quality is good with a conversion time of 1.3 mins which is faster than "veryfast" in x264.
The sample source MTS file is here.
http://www.mediafire.com/?gs7cx6gxe7xrvie
The Freemake converter output is here
http://www.mediafire.com/?clasa2r1k9htkel
please guide me to write a correct script and procedures to get similar output from x264. I am interested with x264 way as I can use filters for videos in low light
:thanks:.
Here is what I tried with ffmpeg
c:\avtools\ffmpeg.exe -y -i %1 -acodec libfaac -ab 192k -vcodec libx264 -vpre faster -crf 24 -threads 0 %1.mp4
This created a huge file than original with 60fps. Video playback is fine. I would be fine 30 fps. Adding -r 3000/1001 resulted smaller file, but video is jerky.
That should be 30000/1001. For some reason ffmpeg seems to duplicate the frames in your video and deinterlacing that results in 60p output. So you need to drop the duplicates with -r 30000/1001.
-deinterlace did not help.
Use a recent ffmpeg build that includes yadif avfilter.
You need to either deinterlace or set x264 to encode as interlaced and deinterlace on playback (which requires a fast CPU or a GPU with deinterlacing/bobbing support).
The video has some glittering effect.
That could be an artifact from yadif. If you get the same with ffmpeg+yadif, post a sample.
I gave up, and converted with FreeMake video converter (ffmpeg/x264), It generated a 25 fps video, But the quality is good with a conversion time of 1.3 mins which is faster than "veryfast" in x264.
That's because it's using veryfast settings and encoded at a low ABR bitrate or 4500 kbps. 25 fps output from 60i is also quite jerky.
please guide me to write a correct script and procedures to get similar output from x264. I am interested with x264 way as I can use filters for videos in low light
You should go for AviSynth if you need good filtering, but this worked for me with ffmpeg:
ffmpeg -i tm55_squirrel.MTS -r 30000/1001 -vf yadif=0 -acodec copy -sn \
-vcodec libx264 -vpre libx264-faster -threads 0 -crf 20 out.mkv
I'd use medium x264 settings though. And perhaps a better deinterlacer, but that requires using AviSynth.
idlebrain
4th April 2011, 01:13
-vf yadif=0
Solves the problem with ffmpeg. I can try different crf and speed presets now. Thanks a lot for your help.
This is my cli
c:\avtools\ffmpeg.exe -y -i %1 -r 30000/1001 -vf yadif=0 -acodec libfaac -ab 192k -vcodec libx264 -vpre faster -crf 24 -threads 0 %1.mp4
Use a recent ffmpeg build that includes yadif avfilter.
I am using Sherpya (March 27 2011) build
:thanks:
That's because it's using veryfast settings and encoded at a low ABR bitrate or 4500 kbps. 25 fps output from 60i is also quite jerky.
Yes. I also did not like that and I need to investigate. May be I don't care as ffmpeg+yadif is working for simple encodes.
That could be an artifact from yadif. If you get the same with ffmpeg+yadif, post a sample.
ffmpeg do not show any glittering with yadif. I will try all options 0(tff),1(bff),-1 in avs and see what happens.
bturner
27th April 2012, 22:43
Hi, Can you please point me to a location where I can download this converting tool? Also, how do you determine what options are needed in the conversion?
I need to convert an AVCHD to mp4. Is there a way of merging multiple AVCHD videos into one MP4 file? I'm am importing AVCHD from a DVD and there are numerous media files (chapters) that I would like to merge into one MP4 movie.
Hi, Can you please point me to a location where I can download this converting tool?
FFmpeg? If you need to ask, it's probably not for you. Try HandBrake (http://handbrake.fr/). I think it even has some support for Blu-ray/AVCHD structures, so you wouldn't need to combine files manually. Other option is to use MakeMKV or some other ripping tool to losslessly convert the AVCHD movie to a single MKV file and then re-encode or remux to MP4.
setarip_old
28th April 2012, 03:46
@bturner
Hi!
AVCHD formats not part of the DVD standard. How/Why did you create AVCHD files on a DVD?
AVCHD formats not part of the DVD standard. How/Why did you create AVCHD files on a DVD?
AVCHD is commonly stored on DVD-5 and DVD-9. I'm pretty sure that's what bturner meant.
bturner
2nd May 2012, 01:33
I don't think handbrake is going to work for me. I need a tool that converts from the command line. Handbrake appears to have a GUI interface. I already have converting tools with a GUI but that is going to take forever considering I have about 3000 movies to convert.
Do either of you know of a command line tool that I can use to convert video files from m2ts format to mp4? I will need to combine multiple m2ts files into one mp4 file. So the command line would look something like this
#<converttool> 0001.mst2 0002.m2ts 0003.m2ts -o output.mp4
With a command line tool I'll be able to create a script that iterates through the directories and converts the m2ts files to mp4.
Any help would be great!
Brian
bturner
2nd May 2012, 01:35
@bturner
Hi!
AVCHD formats not part of the DVD standard. How/Why did you create AVCHD files on a DVD?
These were recorded on a video recorder and then made into either Blu-ray DVD movies or AVCHD movies. I've moved the bluray dvd movies onto a hard drive and now I want to convert them to mp4.
I don't think handbrake is going to work for me. I need a tool that converts from the command line.
https://trac.handbrake.fr/wiki/CLIGuide
I already have converting tools with a GUI but that is going to take forever considering I have about 3000 movies to convert.
To do a good job, you'd have to tweak some things manually. How are you going to deal with interlacing and field blending (in case of badly authored sources), for example? HandBrake's decomb filter is a quick and dirty tool to deinterlace interlaced sources, but it doesn't bob and it will cause serious jerkyness if the source is telecined or field blended.
Other tools aren't much better. Some have autodetection for interlacing and telecine, but they aren't foolproof.
I will need to combine multiple m2ts files
If HandBrake doesn't handle that kind of structure (I think it should), use eac3to to demux or rip with MakeMKV.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.