So there we went, and got the Panasonic HDC-SD9. It's a great camera, which records directly in HD formats, from 1440x1080 to 1920x1080. The only issue came when I wanted to play these videos on my computer. Our poor dual-core Intel Pentium D with 1.5 GB RAM struggles to play the lowest quality the SD9 can produce. So there was a need to transcode this format into a more readable one, for example avi or mov.
My first approach was to use a simple ffmeg line :
ffmpeg -i somefile.mts -s svga -r 25 somefile.mov
It does convert the file to a .mov successfully, but the result is horrible: the images are almost just as grabbled as reading the mts directly with VLC.
This morning, I found this post, which linked to this forum, which features a great talk on how to efficiently transcode AVCHD to mov or avi. It also linked to Ubuntu forums where a guy proposed to use mencoder for the job with something like
mencoder $f -o `basename $f .mts`.avi -oac copy -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=10000 -fps 50 -vf scale=720:576
The result, once again, was horrible in my case.
Eventually, I tried the script located at http://marks.org/avchd/hdffxvrt-mov1-8-09, and it worked great! The only problem I had with it was that most of my videos were in 1440, so I had to use "-i 1440x1080" on them. Otherwise, the results are very nice.
This script has preset formats, so you can simply call it this way
./hdffxvrt-mov1-8-09 -p small -i 1440x1080 00000.mts
Nice and efficient, and uses ffmpeg under the hood, only going through a yuv demux before actually transcoding (from the little I understand about video transcoding at least). You only need to be patient.
Update:
I worked a bit on the script and improved it quite a bit. The first improved version can be found on this link and includes the following changes:
- Take -f switch to choose format (mov by default) instead of having two separate scripts ;
- Use mktemp to create the TMPDIR ;
- Add traps to remove temporary files and directories on interrupt, kill and exit ;
- Also remove output file if the file is interrupted ;
- Try to detect resolution if it wasn't specified with the -i switch. This is currently a bit ugly but it works for me so far. Any improvement in this would be welcome.
After that, I thought it would be nice to integrate it in Dolphin/Konqueror as a service menu. It gave birth to the script you will find on this link. This is still quite a hack, and I will probably work more on it later on, but you are already welcome to try it and give some feedback.

This KDE version includes the following improvements:
- Register .mts files in the system ;
- Call the script from ServiceMenus (Dolphin/Konqueror) for various preset sizes ;
- Uses kdialog to provide information while encoding ;
- Progress bar support interacting with ffmpeg encoding progress ;
- Support for the "Cancel" button while encoding.


17 comments:
Hi,
give a try to Handbrake too.
http://handbrake.fr/
https://launchpad.net/~handbrake-ubuntu/+archive/ppa
bye
Thanks for this: I am looking also for HD camera, but still have non-HD equipment at home, so will go through same pain.
Congrats on expected family member - I am expecting my 3rd kid at the same time as you! ;-)
@romeo: thanks. I had tried Handbrake previously on Mac OS, I didn't know it worked on Linux, too. I might stick with the cli script though, as I think that for now I will just archive the mts (which I can't really use so far) files and only play the transcoded files.
@Lure: Congrats on your 3rd kid, too :)
From the little fun I've had so far, I can really recommend you the Panasonic HDC-SD9 if you don't mind going through the conversion steps.
Hello, I use mencoder to convert my MTS files from my AVCHD camera. I adjust the fps depending on the sycn. Below is my command..
mencoder 00037.MTS -o 37.avi -oac copy -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=10000 -fps 65 -vf scale=1280:720
josh
linuxcrypt.net
@linuxcrypt: Yes, this is the command I posted in the beginning of my blogpost, which I found on Ubuntu forums (and I believe you posted it there actually). It didn't work at all for me though. Maybe it's because I ran on a 1440x1080 movie instead of a 1920x1080. I'll try on a 1920, but at least I know the script using ffmpeg works great :)
ironically the master copy of HDFFXVRT (the url's in the script - http://code.google.com/p/hdffxvrt/ - is set up for 1440i ; the copy at marks.org is hacked up for other kinds of cameras.
I am looking for people who can test updates - shall get around to it in the next few weeks.
- alec
ps: if you're using the marks.org script without modification, your transcoded video may be at NTSC framerates, not PAL - this may or may not be important to you :-)
@AlecMuffett : thanks for the details. Once I found out the -i option, 1440 vs 1920 doesn't really matter. Thanks for mentioning the NTSC vs PAL issue though, since I am in Europe. What is the usual format for movies found online (youtube, etc.), NTSC or PAL? Maybe this could be added as an option to the script.
Hey Raphael,
looks like, that I and my girl are also becoming parents officially at the end of April.
Hopefully, he is a fast one and wants to welcome the world around jaunties release ,-)
Good Luck to you and your partner :)
Greetings from Germany,
Stephan aka \sh
Thanks Stephan. Congrats to you!
Hope to see you some time.
Cheers
>What is the usual format for movies found online (youtube, etc.), NTSC or PAL?
Once you are away from actual TV / television hardware, all the rules vanish - so in the digital realm prettymuch anything is permissible. The main worry about using the wrong geographical standard (NTSC for Americas, PAL for Europe) is just in case 1) you see yourself exporting stuff back to VCR, camcorders or other devices which have a television-bias, or 2) you want to use iMovie or similar in conjunction with footage from tv-focused camcorders, etc.
Otherwise it's not really something to worry about overmuch. :-)
Thanks for the ideas
- alec
@AlecMuffett: The movies are mostly for family. Now my wife's family is mostly in America (US, Caribbeans, Colombia) while my family is in Europe (France). So... I might make exports in both NTSC and PAL to please everybody... Thank you bash for automating my digital life :)
@AlecMuffett: I have made a new version of the script with a few improvements on http://r.pinson.free.fr/avchd/hdffxvrt-raphink-2-20-09 . The improvements include :
* Take -f switch to choose format (mov by default) instead of having two separate scripts ;
* Use mktemp to create the TMPDIR ;
* Add traps to remove temporary files and directories on interrupt, kill and exit ;
* Also remove output file if the file is interrupted ;
* Try to detect resolution if it wasn't specified with the -i switch. This is currently a bit ugly but it works for me so far. Any improvement in this would be welcome ;
Feel free to merge these improvements.
thanks raphael! i will take a look.
Hi,
I am glad that you found useful my slight modification (hdffxvrt-mov1-8-09) to Alec's script.
It works well, except ffmpeg doesn't have a lot of filters. I am often shooting 24P on my Canon HF11, so I need a good pull-down removal filter. The hdffxvrt script can't really remove the Canon 24P pull-down -- it just duplicates and drops frames and deinterlaces the video.
The best, open-source pull-down removal filter that I have found for my HF11 24P footage is the "detc" filter in mencoder.
I also need to be able to give files to editors that they can use in Final Cut Pro, and ffmpeg is great for converting formats.
So, the procedure I am trying now is to remove the 24P pull-down in mencoder, and, then, I use ffmpeg to convert the resulting file to the Quicktime format at the desired bitrate.
Here is the mencoder command:
mencoder canon_24p_footage.mts -fps 60000/1001 -oac pcm -demuxer lavf -vf detc,softskip -ofps 24000/1001 -ovc lavc -lavcopts vcodec=ffvhuff:format=YV12:vstrict=-1:aspect=16/9 -o intermediate_file.avi
And I follow-up with this ffmpeg command:
ffmpeg -i intermediate_file.avi -vcodec mpeg4 -b 35000k -f mov -acodec copy final_quicktime_file.mov
Then I remove the intermediate file.
A test run is posted at http://marks.org/avchd/ The test file is ffmpeg05.mov (The original Canon AVCHD footage is also posted on this page -- 00053.mts).
I am doing this manually. It will probably get tedious and time consuming when there are a lot of files to convert. If someone is good at making scripts, I would welcome any help in writing one for this procedure.
In addition, I wonder if it is better/cleaner to use the raw video format in mencoder and, then, pipe that result into ffmpeg.
I was unable to achieve the 35 Mb/s bitrate -- is that a Quicktime limitation? The Canon HF11 AVCHD footage was recorded at 24Mb/s. I would like to encode at 35Mb/s into a format that can be used in Final Cut Pro.
Any opinions and suggestions are appreciated.
By the way, I also made a smaller AVI file with this method and posted it on the same page: "
ffmpeg07.avi".
I'll also post this message in the AVS forum.
Thanks,
-Dale
I got my Canon HF100 and your script works with minor modification (irate/orate set to 50).
I am also impressed with kdenlive in Jaunty: it just works for me, but I need to test further and do some more editing.
But very pleasant start and I am happy that I did not need to install Windows SW yet.
I documented how to remove the 24P pulldown on all the AVCHD files generated by the Canon HF11. It applies to Linux, Unix and probably OSX.
You can read the details in this forum post: http://www.avsforum.com/avs-vb/showthread.php?p=16122693#post16122693
-Dale
Post a Comment