avconv converting videos in really bad quality
Get ffmpeg

Download a recent build of ffmpeg. Binaries for Windows, Linux, and OS X are available on the FFmpeg Download page. Development is very active and there is no need to use buggy avconv (note that this answer was written for ffmpeg, so I'm not sure if any examples will work with avconv).

Theora video &amp; Vorbis audio in OGG

Theora is old and has been superseded in many cases by VP8/VP9 video in WebM (see example below), so there are few reasons to use Theora in OGG/OGV.

ffmpeg -i input -c:v libtheora -q:v 5 -c:a libvorbis -q:a 5 output.ogv



-q:v – video quality. Range is 0-10, where 10 is highest quality. 5-7 is a good range to try. If you omit -q:v then ffmpeg will use the default of -b:v 200k which will most likely provide a poor quality output, and libtheora may drop/skip frames if the bitrate is too low. 
-q:a – audio quality. Range is 0-10, where 10 is highest quality. 3-6 is a good range to try. Default is -q:a 3. 


Adapted from FFmpeg Wiki: A Brief Theora and Vorbis Encoding Guide.

VP8 video &amp; Vorbis audio in WebM

ffmpeg -i input -c:v libvpx -qmin 0 -qmax 50 -crf 5 -b:v 1M -c:a libvorbis -q:a 5 output.webm



See FFmpeg Wiki: VP8 Encoding Guide and VP8 Encode Parameter Guide to optimize your command.
If you want to encode VP9 video, then use -c:v libvpx-vp9. It is currently a slow encoder.