[FFmpeg-user] Near lossless encoding is it even possible?

David Klasinc bigwhale at lubica.net
Tue Dec 27 11:48:07 CET 2011


On 12/27/2011 11:01 AM, Nicolas George wrote:

>>
>> http://ubuntuone.com/6CoEBUnoPUM644PPOSiY84
> 
> Try mplayer -vo x11 to play the video you have encoded with the command-line
> above. If it does not help, show us the full output of both ffmpeg and
> mplayer.


Well, I'll be ...

If I capture with:

$ ffmpeg -y -f x11grab -r 25 -s 800x800 -i :0.0+0,0 \
  -vcodec huffyuv lala.avi

And play with mplayer -vo x11 the output is crystal clear. If I encode
with x264 and use -vo x11 the output is still not what I want it to be,
but different than when I don't use -vo x11. Here's the comparison:

http://ubuntuone.com/22mp70vCLuMdPD5peX4xDK

Here's the output of ffmpeg when encoding:

bigwhale at thefish:~$ ffmpeg -y -f x11grab -r 25 -s 800x800 -i :0.0+0,0
-vcodec libx264 -preset ultrafast -qp 0 lala.mkv
ffmpeg version N-32924-gb725443, Copyright (c) 2000-2011 the FFmpeg
developers
  built on Dec 27 2011 09:12:18 with gcc 4.6.1
  configuration: --enable-gpl --enable-libfaac --enable-libmp3lame
--enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora
--enable-libvorbis --enable-libx264 --enable-nonfree --enable-postproc
--enable-version3 --enable-x11grab
  libavutil      51. 33.100 / 51. 33.100
  libavcodec     53. 48.100 / 53. 48.100
  libavformat    53. 28.100 / 53. 28.100
  libavdevice    53.  4.100 / 53.  4.100
  libavfilter     2. 54.100 /  2. 54.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0.  5.100 /  0.  5.100
  libpostproc    51.  2.100 / 51.  2.100
[x11grab @ 0x29b1a20] device: :0.0+0,0 -> display: :0.0 x: 0 y: 0 width:
800 height: 800
[x11grab @ 0x29b1a20] shared memory extension found
[x11grab @ 0x29b1a20] Estimating duration from bitrate, this may be
inaccurate
Input #0, x11grab, from ':0.0+0,0':
  Duration: N/A, start: 1324981724.074622, bitrate: 512000 kb/s
    Stream #0:0: Video: rawvideo (BGRA / 0x41524742), bgra, 800x800,
512000 kb/s, 25 tbr, 1000k tbn, 25 tbc
Incompatible pixel format 'bgra' for codec 'libx264', auto-selecting
format 'yuv420p'
[buffer @ 0x29c4ca0] w:800 h:800 pixfmt:bgra tb:1/1000000 sar:0/1 sws_param:
[buffersink @ 0x29c2b00] auto-inserting filter 'auto-inserted scale 0'
between the filter 'src' and the filter 'out'
[scale @ 0x29c33c0] w:800 h:800 fmt:bgra -> w:800 h:800 fmt:yuv420p
flags:0x4
[libx264 @ 0x29bf580] using cpu capabilities: MMX2 SSE2Fast SSSE3
FastShuffle SSE4.2 AVX
[libx264 @ 0x29bf580] profile High 4:4:4 Predictive, level 3.1, 4:2:0 8-bit
[libx264 @ 0x29bf580] 64 - core 120 r2120 0c7dab9 - H.264/MPEG-4 AVC
codec - Copyleft 2003-2011 - http://www.videolan.org/x264.html -
options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=0
mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0
deadzone=21,11 fast_pskip=0 chroma_qp_offset=0 threads=6
sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0
constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=25
scenecut=0 intra_refresh=0 rc=cqp mbtree=0 qp=0
Output #0, matroska, to 'lala.mkv':
  Metadata:
    encoder         : Lavf53.28.100
    Stream #0:0: Video: h264, yuv420p, 800x800, q=-1--1, 1k tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo -> libx264)
Press [q] to stop, [?] for help
frame=  151 fps= 25 q=-1.0 Lsize=    1410kB time=00:00:06.00
bitrate=1924.4kbits/s
video:1408kB audio:0kB global headers:0kB muxing overhead 0.113894%
[libx264 @ 0x29bf580] frame I:1     Avg QP: 0.00  size:130235
[libx264 @ 0x29bf580] frame P:150   Avg QP: 0.00  size:  8739
[libx264 @ 0x29bf580] mb I  I16..4: 100.0%  0.0%  0.0%
[libx264 @ 0x29bf580] mb P  I16..4: 24.5%  0.0%  0.0%  P16..4:  0.2%
0.0%  0.0%  0.0%  0.0%    skip:75.4%
[libx264 @ 0x29bf580] coded y,uvDC,uvAC intra: 6.7% 11.5% 11.2% inter:
0.1% 0.2% 0.2%
[libx264 @ 0x29bf580] i16 v,h,dc,p: 97%  3%  0%  0%
[libx264 @ 0x29bf580] i8c dc,h,v,p: 86%  7%  7%  0%
[libx264 @ 0x29bf580] kb/s:1908.81

*********************

And here from mplayer (first with no parameters, then with -vo x11)

*********************

bigwhale at thefish:~$ mplayer lala.mkv
mplayer: Symbol `ff_codec_bmp_tags' has different size in shared object,
consider re-linking
MPlayer SVN-r33713-4.6.1 (C) 2000-2011 MPlayer Team
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote
control.

Playing lala.mkv.
libavformat file format detected.
[matroska,webm @ 0x29af3a0] Estimating duration from bitrate, this may
be inaccurate
[lavf] stream 0: video (h264), -vid 0
VIDEO:  [H264]  800x800  0bpp  25.000 fps    0.0 kbps ( 0.0 kbyte/s)
Clip info:
 ENCODER: Lavf53.28.100
Load subtitles in ./
open: No such file or directory
[MGA] Couldn't open: /dev/mga_vid
open: No such file or directory
[MGA] Couldn't open: /dev/mga_vid
[VO_TDFXFB] Can't open /dev/fb0: Permission denied.
[VO_3DFX] Unable to open /dev/3dfx.
Failed to open VDPAU backend libvdpau_nvidia.so: cannot open shared
object file: No such file or directory
[vdpau] Error when calling vdp_device_create_x11: 1
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
==========================================================================
Audio: no sound
Starting playback...
Unsupported PixelFormat 61
Unsupported PixelFormat 53
Movie-Aspect is 1.00:1 - prescaling to correct movie aspect.
VO: [xv] 800x800 => 800x800 Planar YV12
V:   3.0   0/  0  6%  1%  0.0% 0 0

bigwhale at thefish:~$ mplayer -vo xv lala.mkv
mplayer: Symbol `ff_codec_bmp_tags' has different size in shared object,
consider re-linking
MPlayer SVN-r33713-4.6.1 (C) 2000-2011 MPlayer Team
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote
control.

Playing lala.mkv.
libavformat file format detected.
[matroska,webm @ 0x126f4a0] Estimating duration from bitrate, this may
be inaccurate
[lavf] stream 0: video (h264), -vid 0
VIDEO:  [H264]  800x800  0bpp  25.000 fps    0.0 kbps ( 0.0 kbyte/s)
Clip info:
 ENCODER: Lavf53.28.100
Load subtitles in ./
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
==========================================================================
Audio: no sound
Starting playback...
Unsupported PixelFormat 61
Unsupported PixelFormat 53
Movie-Aspect is 1.00:1 - prescaling to correct movie aspect.
VO: [xv] 800x800 => 800x800 Planar YV12
V:   6.0   0/  0  4%  0%  0.0% 0 0





More information about the ffmpeg-user mailing list