[FFmpeg-user] Good royalty free codec to encode H.264 video with.

Andrei Petru Mura mapandrei at gmail.com
Thu Dec 19 10:19:38 CET 2013


>
> > ffmpeg -c:v h264 -i /path/to/file.avi -map 0:0 -c:v mjpeg
> > -r 30 -qmin 1 -qmax 1 -an -vf hfpli file.avi
>
> What is hfpli?
>
Just a typo. "hflip" was the intended command. Anyway, I think this does
not affect to much the quality or the conversion speed.

>
> Mostly unrelated:
> Remove "-c:v h264", it makes no sense (in most command lines),
> old documentation always suggested a minimal quantiser of "2"
> (instead of "1"), iirc that significantly reduces the filesize.
>
> > *N.B.:* I put the whole command for having a clear idea
> > of what I'm talking about.
>
> But you didn't think of providing the console output which
> is usually needed if you need support here ;-(
>

Here is what I tried now, with suggested improvements:

/home/netnfork/bin/ffmpeg -i ./concatenated5.avi -map 0:0 -c:v libvpx -qmin
2 -qmax 5 -crf 2 -b:v 1M -an -vf hflip -threads 4 ../out.avi
ffmpeg version N-40403-ge10fccf Copyright (c) 2000-2013 the FFmpeg
developers
  built on Dec 18 2013 14:00:03 with gcc 4.4.7 (GCC) 20120313 (Red Hat
4.4.7-4)
  configuration: --prefix=/home/netnfork/ffmpeg_build
--extra-cflags=-I/home/netnfork/ffmpeg_build/include
--extra-ldflags=-L/home/netnfork/ffmpeg_build/lib
--bindir=/home/netnfork/bin --extra-libs=-ldl --enable-gpl --enable-nonfree
--enable-libfdk_aac --enable-libmp3lame --enable-libopus --enable-libvorbis
--enable-libvpx --enable-libx264
  libavutil      52. 58.101 / 52. 58.101
  libavcodec     55. 45.102 / 55. 45.102
  libavformat    55. 22.100 / 55. 22.100
  libavdevice    55.  5.102 / 55.  5.102
  libavfilter     4.  0.100 /  4.  0.100
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
  libpostproc    52.  3.100 / 52.  3.100
Input #0, avi, from './concatenated5.avi':
  Metadata:
    encoder         : Lavf55.19.102
  Duration: 00:00:55.40, start: 0.000000, bitrate: 9057 kb/s
    Stream #0:0: Video: h264 (High) (X264 / 0x34363258), yuvj420p(pc),
1920x1080, 30 fps, 30 tbr, 30 tbn, 30 tbc
[swscaler @ 0xa07e060] deprecated pixel format used, make sure you did set
range correctly
[libvpx @ 0xa092ce0] v1.3.0-416-gbb12bba
Output #0, avi, to '../out.avi':
  Metadata:
    ISFT            : Lavf55.22.100
    Stream #0:0: Video: vp8 (libvpx) (VP80 / 0x30385056), yuv420p,
1920x1080, q=2-5, 1000 kb/s, 30 tbn, 30 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (h264 -> libvpx)
Press [q] to stop, [?] for help
frame=  100 fps=2.0 q=0.0 size=   14743kB time=00:00:03.33
bitrate=36233.5kbits/s

Is there something wrong with the bitrate? I can see the output bitrate is
bigger, but I think that should be a plus regarding the quality. Anyway, it
still has a significant space until it comes to the specified limit (-b:v
1M). But as you can still, the processing speed is still relatively slow
(2.0 fps if I know to interpret correctly the output).

>
> > I tried to do the same thing, but using a different
> > encoder, namely libvpx-vp9. The resulted file is at a size
> > comparable with H.264, but there are 2 issues:
>
> > the quality is clearly lower than the original file
>
> This should not happen: If you accept a sufficiently
> high bitrate (which is much closer to h264 than mjpeg),
> you should get perfect quality with both vp8 and vp9
> (vp8 should be faster).


> Concerning your original question, consider using
> mpeg1video but if vp8 is acceptable, it should be
> able to produce significantly smaller files for a
> given quality.
>
> Carl Eugen
>


More information about the ffmpeg-user mailing list