Convert Pentax K-5 AVI video to OGG for wikipedia in Ubuntu Precise Pangolin… with no clicks
I captured a video with my Pentax K-5, and I wanted to send it to Wikipedia (in fact, to Wikimedia Commons) where OGG files are required. The conversion can be done very easily under Linux with avconv (previously known as ffmpeg):
avconv -i IMGP7212.AVI -acodec libvorbis -ab 256k -ac 2 -vcodec libtheora -qscale 10 IMGP7212.ogg
However, the sound is poor because there are clicks (or thumps or cracks or whatever you want) every second or so. Apparently it is frequent issue that is hardware or software dependent. I get a good sound if I play the video in VLC, apparently the PCM audio is correctly handled. As VLC can convert media files, I used it to get a video with a decent audio.
Let's go through.
- The first step is to open VLC and select the Media > “Convert / Save” menu. Select your file and click on the “Convert / Save” button.
- Select the destination file.
- In the Profile setting, choose “Video – Theora + Flac (OGG)”. You need vorbis audio encoding if you want the sound track to play in Firefox (and probably others), but on my computers the vorbis encoder is broken. We'll care about that later.
- Click on the “Edit selected profile” button just on the right of the profile.
- In the Video codec tab, make sure the Video checkbox is checked, “Keep original video track” is unchecked and Theora is selected as codec. Select a good bitrate (you can go up to 5000 or 10000 kb/s if you want a good quality and your video isn't too long. It'll generate a big video file, but not at all as big as the original AVI anyway, and Mediawiki will resize the video itself when it sends it to the web browsers.).
- Select Frame Rate and Width according to the video options you have set in your K-5. Leave the Scale and Height fields blank (or 0)
- In the Audio codec tab, make sure the Audio checkbox is checked, “Keep original audio track” is unchecked and the Flac codec is selected. I believe Bitrate is ignored. Channels is 1 but we will switch to 2 later anyway, so put what you want here. Sample Rate is 44100.
- Click Save.
- Click Start.
When the conversion is done in VLC, we switch to a command line to re-encode the audio track in vorbis. We set the vorbis codec (
-acodec libvorbis), with a good bit rate (
-acodec libvorbis) and 2 channels (
-ac 2, apparently avconv cannot deal with only 1). We keep the video track intact (
avconv -i IMGP2712.ogg -acodec libvorbis -ab 256k -ac 2 -vcodec copy IMGP2712_vorbis.ogg
And that's it! You can now upload your video that doesn't click.
Publié le mercredi 1 août 2012 à 16:34 CEST
Lien permanent : /blog/2012/08/01/convert-pentax-k-5-avi-video-to-ogg-for-wikipedia-in-ubuntu-precise-pangolin-with-no-clicks
Tags : Photo Ubuntu
Commentaires : 0