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.

  1. The first step is to open VLC and select the Media > “Convert / Save” menu. Select your file and click on the “Convert / Save” button.
  2. Select the destination file.
  3. 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.
  4. Click on the “Edit selected profile” button just on the right of the profile.
  5. 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.).
  6. 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)
  7. 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.
  8. Click Save.
  9. Click Start.
  10. Wait.

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 (-vcodec copy).

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.

Xavier Robin
Published Wednesday, August 1, 2012 16:34 CEST
Permalink: /blog/2012/08/01/convert-pentax-k-5-avi-video-to-ogg-for-wikipedia-in-ubuntu-precise-pangolin-with-no-clicks
Tags: Photo Ubuntu
Comments: 0

Comments

No comment

New comment

* denotes a mandatory field.

By submitting your message, you accept to publish it under a CC BY-SA 3.0 license.

Some HTML tags are allowed: a[href, hreflang, title], br, em, i, strong, b, tt, samp, kbd, var, abbr[title], acronym[title], code, q[cite], sub, sup.

Passer en français

Search

Tags

Background noise Books Computers Fun Hobbies Internet Me Mozilla My website Photo Politics Programming School Software Ubuntu pROC

Recent posts

Calendar

MonTueWedThuFriSatSun
12345
6789101112
13141516171819
20212223242526
2728293031

Syndication

Recommend