Avconv rotating mpeg4 - video loses quality
There's no way to do this losslessly, other than setting a meta-data flag and depending on players to rotate the video.  (This is what cell-phone cameras do).

With avconv / ffmpeg, what you're doing is using your decoded -> transposed video as a source to encode with x264.  See https://trac.ffmpeg.org/wiki/Encode/H.264 for how to do this.  IDK where you found a suggestion to use -qcomp 1, but changing the quantizer compression curve to an extreme is usually not what you want with x2641.

You shouldn't need to enforce framerate, either.  Phone cam videos are sometimes variable frame rate, so you should use -vsync 2 if you're outputting to mp4.  (vsync 2 is the default for mkv).

Anyway, this should work:

ffmpeg -i in.mp4 -codec copy -map 0 -movflags +faststart -vf transpose=1 -c:v libx264 -preset slower -crf 22  -vsync 2 out.mp4

(also include -metadata:s:v rotate="" if needed, see LordNeckBeard's comment.)

See the encode guide for details on how to choose crf and preset.

-map 0 maps any extra metadata streams, like chapters, into the output file.

-codec copy copies the audio untouched, instead of decoding and re-encoding.

Since you're re-encoding anyway, you might want to stabilize your video with vid.stab.  See https://askubuntu.com/questions/405244/deshaking-videos-using-script for instructions (and a note on avconv vs. ffmpeg).  The command I posted works with avconv as well as ffmpeg, but Ubuntu's avconv isn't built with vid.stab.



Footnote 1:   -qcomp 1 is pure constant quality (or constant-something, maybe quantization, which isn't exactly the same thing as quality).  i.e. not reducing quality in high-complexity scenes at all.  (So you potentially spend a lot of bits in a few short scenes / shots / segments which make up a small fraction of the total time of the video, leaving less bitrate for the stuff where those bits gain you more quality.  -qcomp 0 is basically CBR.

The default 0.6 is often a good choice, but some people like to boost it some, maybe to 0.7 or 0.8, to get closer to constant-QP.  -tune grain (try to preserve film-grain instead of smoothing it out) sets qcomp=0.8, among many other psy settings.  (most importantly -psy-rd &lt;unset&gt;:0.25 to favour more energy, even if it doesn't match the source.)

qcomp Anywhere in the middle smooths out the bitrate curve some.