Ffmpeg ekran yakalama yeteneklerini merak ettim ve h264'te basit bir gerçek zamanlı yakalama testi ile uğraşmaya başladım.
ffmpeg -f dshow -i video="screen-capture-recorder" -video_size 1920x1080 -framerate 30 -c:v libx264 -crf 0 -preset ultrafast capture.mkv
Ffmpeg h264 belgelerinde söylenenlere dayanarak -qp 0
veya -crf 0
libx264 seçenekleri ile birlikte kayıpsız modda çalışmalıdır.
Kayıpsız bir çıkışı kodlamak için -qp 0 veya -crf 0 kullanabilirsiniz. 8-bit ve 10-bit x264, kayıpsız için farklı -crf değerleri kullandığından, -qp'nin -crf üzerinden kullanılması önerilir.
Bu, gerçek zamanlı yakalama bölümü yardımında, bazı boyutları kaydetmeyi denemek için daha yavaş bir ön ayarlı isteğe bağlı bir yeniden kodlama hakkında konuşurken de tekrarlanır:
İlk kayıt kayıpsız olduğundan ve yeniden kodlamanın da kayıpsız olduğundan, bu işlemde hiçbir şekilde kalite kaybı meydana gelmediğini unutmayın.
Buna dayanarak kılavuza güvendim ve -qp 0 kullanarak kabul ettim.
Ancak bazı durumlarda bazı kayıplar verdiğini gördüm.
Bu kod ile huffyuv codec bileşeni ile başka bir test yaptım:
ffmpeg -f dshow -i video="screen-capture-recorder" -video_size 1920x1080 -framerate 30 -c:v huffyuv capture.mkv
sonuçlar:
Ekran 1: Kayıpsız modda h264
Ekran 2: Huffyuv
Ekranlara dayalı huffyuv
mükemmel, gerçek bir kayıpsız codec bileşeni h264
yerine burada bir şey sıkıştırmak ve kayıpsız bir modda ayarlanması gerektiğini neden anlayamıyorum.
(huffyuv masaüstünün bir bitmap ekran görüntüsü ile aynıdır, h264 ile aynı şeyi elde ederim)
Birisi bunu anlamama yardımcı olabilir mi?
Düzenleme: Yorumlarda gerektiği gibi bazı ffmpeg dökümleri ekleme;)
h264 koşusu:
ffmpeg -f dshow -i video="screen-capture-recorder" -video_size 1920x1080 -framerate 30 -c:v libx264 -qp 0 -preset ultrafast capture.mkv
ffmpeg version N-73411-g5233f25 Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.9.2 (GCC)
configuration: --arch=x86_64 --target-os=mingw32 --cross-prefix=/home/user/san
dbox/mingw-w64-x86_64/bin/x86_64-w64-mingw32- --pkg-config=pkg-config --enable-g
pl --enable-libsoxr --enable-fontconfig --enable-libass --enable-libutvideo --en
able-libbluray --enable-iconv --enable-libtwolame --extra-cflags=-DLIBTWOLAME_ST
ATIC --enable-libzvbi --enable-libcaca --enable-libmodplug --extra-libs=-lstdc++
--extra-libs=-lpng --enable-libvidstab --enable-libx265 --enable-decklink --ext
ra-libs=-loleaut32 --enable-libx264 --enable-libxvid --enable-libmp3lame --enabl
e-version3 --enable-zlib --enable-librtmp --enable-libvorbis --enable-libtheora
--enable-libspeex --enable-libopenjpeg --enable-gnutls --enable-libgsm --enable-
libfreetype --enable-libopus --disable-w32threads --enable-frei0r --enable-filte
r=frei0r --enable-libvo-aacenc --enable-bzlib --enable-libxavs --enable-libopenc
ore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-libschroed
inger --enable-libvpx --enable-libilbc --enable-libwavpack --enable-libwebp --en
able-libgme --enable-dxva2 --enable-libdcadec --enable-avisynth --enable-static
--disable-shared --extra-cflags= --prefix=/home/user/sandbox/mingw-w64-x86_64/x8
6_64-w64-mingw32 --extra-libs=-lpsapi --enable-nonfree --enable-libfdk-aac --dis
able-libfaac --enable-nvenc --enable-runtime-cpudetect
libavutil 54. 28.100 / 54. 28.100
libavcodec 56. 46.101 / 56. 46.101
libavformat 56. 40.100 / 56. 40.100
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 20.100 / 5. 20.100
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.100 / 1. 2.100
libpostproc 53. 3.100 / 53. 3.100
leaving aero onInput #0, dshow, from 'video=screen-capture-recorder':
Duration: N/A, start: 362931.503000, bitrate: N/A
Stream #0:0: Video: rawvideo, bgr0, 1920x1080, 30 tbr, 10000k tbn, 30 tbc
No pixel format specified, yuv444p for H.264 encoding chosen.
Use -pix_fmt yuv420p for compatibility with outdated media players.
[libx264 @ 00000000004c7e00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 00000000004c7e00] profile High 4:4:4 Predictive, level 4.0, 4:4:4 8-b
it
[libx264 @ 00000000004c7e00] 264 - core 144 r2533 c8a773e - H.264/MPEG-4 AVC cod
ec - Copyleft 2003-2015 - http://www.videolan.org/x264.html - options: cabac=0 r
ef=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=0 mixed_ref=0 me_range=16 chro
ma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=0 chroma_qp_offset=0
threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 blur
ay_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=25 sce
necut=0 intra_refresh=0 rc=cqp mbtree=0 qp=0
Output #0, matroska, to 'capture.mkv':
Metadata:
encoder : Lavf56.40.100
Stream #0:0: Video: h264 (libx264) (H264 / 0x34363248), yuv444p, 1920x1080,
q=-1--1, 30 fps, 1k tbn, 30 tbc
Metadata:
encoder : Lavc56.46.101 libx264
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
Press [q] to stop, [?] for help
frame= 11 fps=0.0 q=0.0 size= 2421kB time=00:00:00.20 bitrate=99163.6kbits/
frame= 22 fps= 22 q=0.0 size= 2538kB time=00:00:00.73 bitrate=28368.6kbits/
frame= 33 fps= 22 q=0.0 size= 2647kB time=00:00:01.26 bitrate=17116.4kbits/
frame= 46 fps= 23 q=0.0 size= 2770kB time=00:00:01.80 bitrate=12608.4kbits/
frame= 58 fps= 23 q=0.0 size= 2842kB time=00:00:02.23 bitrate=10427.1kbits/
frame= 71 fps= 23 q=0.0 size= 2908kB time=00:00:02.80 bitrate=8508.6kbits/s
frame= 83 fps= 23 q=0.0 size= 2977kB time=00:00:03.26 bitrate=7467.0kbits/s
frame= 96 fps= 24 q=0.0 size= 3085kB time=00:00:03.80 bitrate=6649.8kbits/s
frame= 108 fps= 24 q=0.0 size= 3195kB time=00:00:04.30 bitrate=6084.5kbits/s
frame= 120 fps= 24 q=0.0 size= 3309kB time=00:00:04.80 bitrate=5645.8kbits/s
frame= 133 fps= 24 q=0.0 size= 3398kB time=00:00:05.33 bitrate=5219.0kbits/s
frame= 147 fps= 24 q=0.0 size= 3492kB time=00:00:05.86 bitrate=4876.1kbits/s
frame= 160 fps= 24 q=0.0 size= 3568kB time=00:00:06.36 bitrate=4591.4kbits/s
frame= 173 fps= 24 q=0.0 size= 3660kB time=00:00:06.86 bitrate=4366.2kbits/s
frame= 186 fps= 25 q=0.0 size= 3720kB time=00:00:07.36 bitrate=4136.5kbits/s
frame= 187 fps= 24 q=-1.0 Lsize= 3737kB time=00:00:07.63 bitrate=4010.9kbits
/s
video:3735kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing
overhead: 0.052628%
[libx264 @ 00000000004c7e00] frame I:1 Avg QP: 0.00 size:1345491
[libx264 @ 00000000004c7e00] frame P:186 Avg QP: 0.00 size: 13327
[libx264 @ 00000000004c7e00] mb I I16..4: 100.0% 0.0% 0.0%
[libx264 @ 00000000004c7e00] mb P I16..4: 16.5% 0.0% 0.0% P16..4: 0.3% 0.0
% 0.0% 0.0% 0.0% skip:83.3%
[libx264 @ 00000000004c7e00] coded y,u,v intra: 6.1% 3.8% 3.9% inter: 0.2% 0.1%
0.1%
[libx264 @ 00000000004c7e00] i16 v,h,dc,p: 96% 4% 0% 0%
[libx264 @ 00000000004c7e00] kb/s:4008.11
[dshow @ 00000000004bf760] real-time buffer [screen-capture-recorder] [video inp
ut] too full or near too full (545% of size: 3041280 [rtbufsize parameter])! fra
me dropped!
Exiting normally, received signal 2.
Terminate batch job (Y/N)?
huffyuv koşmak:
ffmpeg -f dshow -i video="screen-capture-recorder" -video_size 1920x1080 -framerate 30 -c:v huffyuv capture.mkv
ffmpeg version N-73411-g5233f25 Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.9.2 (GCC)
configuration: --arch=x86_64 --target-os=mingw32 --cross-prefix=/home/user/san
dbox/mingw-w64-x86_64/bin/x86_64-w64-mingw32- --pkg-config=pkg-config --enable-g
pl --enable-libsoxr --enable-fontconfig --enable-libass --enable-libutvideo --en
able-libbluray --enable-iconv --enable-libtwolame --extra-cflags=-DLIBTWOLAME_ST
ATIC --enable-libzvbi --enable-libcaca --enable-libmodplug --extra-libs=-lstdc++
--extra-libs=-lpng --enable-libvidstab --enable-libx265 --enable-decklink --ext
ra-libs=-loleaut32 --enable-libx264 --enable-libxvid --enable-libmp3lame --enabl
e-version3 --enable-zlib --enable-librtmp --enable-libvorbis --enable-libtheora
--enable-libspeex --enable-libopenjpeg --enable-gnutls --enable-libgsm --enable-
libfreetype --enable-libopus --disable-w32threads --enable-frei0r --enable-filte
r=frei0r --enable-libvo-aacenc --enable-bzlib --enable-libxavs --enable-libopenc
ore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-libschroed
inger --enable-libvpx --enable-libilbc --enable-libwavpack --enable-libwebp --en
able-libgme --enable-dxva2 --enable-libdcadec --enable-avisynth --enable-static
--disable-shared --extra-cflags= --prefix=/home/user/sandbox/mingw-w64-x86_64/x8
6_64-w64-mingw32 --extra-libs=-lpsapi --enable-nonfree --enable-libfdk-aac --dis
able-libfaac --enable-nvenc --enable-runtime-cpudetect
libavutil 54. 28.100 / 54. 28.100
libavcodec 56. 46.101 / 56. 46.101
libavformat 56. 40.100 / 56. 40.100
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 20.100 / 5. 20.100
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.100 / 1. 2.100
libpostproc 53. 3.100 / 53. 3.100
leaving aero onInput #0, dshow, from 'video=screen-capture-recorder':
Duration: N/A, start: 362514.497000, bitrate: N/A
Stream #0:0: Video: rawvideo, bgr0, 1920x1080, 30 tbr, 10000k tbn, 30 tbc
[huffyuv @ 0000000000380ae0] using huffyuv 2.2.0 or newer interlacing flag
[huffyuv @ 0000000000377280] using huffyuv 2.2.0 or newer interlacing flag
[huffyuv @ 00000000003b0fc0] using huffyuv 2.2.0 or newer interlacing flag
[huffyuv @ 00000000003b1700] using huffyuv 2.2.0 or newer interlacing flag
[huffyuv @ 0000000000357a00] using huffyuv 2.2.0 or newer interlacing flag
Output #0, matroska, to 'capture.mkv':
Metadata:
encoder : Lavf56.40.100
Stream #0:0: Video: huffyuv (HFYU / 0x55594648), rgb24, 1920x1080, q=2-31, 2
00 kb/s, 30 fps, 1k tbn, 30 tbc
Metadata:
encoder : Lavc56.46.101 huffyuv
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo (native) -> huffyuv (native))
Press [q] to stop, [?] for help
frame= 12 fps=0.0 q=0.0 size= 23668kB time=00:00:00.50 bitrate=386999.4kbits
frame= 22 fps= 22 q=0.0 size= 44696kB time=00:00:00.96 bitrate=379033.1kbits
frame= 35 fps= 23 q=0.0 size= 72074kB time=00:00:01.46 bitrate=402750.2kbits
frame= 49 fps= 24 q=0.0 size= 101620kB time=00:00:02.00 bitrate=416236.4kbits
frame= 63 fps= 25 q=0.0 size= 131190kB time=00:00:02.50 bitrate=429712.0kbits
frame= 78 fps= 26 q=0.0 size= 162896kB time=00:00:03.03 bitrate=439829.0kbits
frame= 83 fps= 26 q=0.0 Lsize= 175587kB time=00:00:03.23 bitrate=444776.1kbit
s/s
video:175582kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxin
g overhead: 0.002479%
[dshow @ 000000000034f420] real-time buffer [screen-capture-recorder] [video inp
ut] too full or near too full (545% of size: 3041280 [rtbufsize parameter])! fra
me dropped!
Exiting normally, received signal 2.
Terminate batch job (Y/N)?
Not: Cevabı genel amaçlarla kabul etsem bile, @ paul-b-mahol tarafından sağlanan çözümü libx264rgb kodlayıcıyla kullanma eğilimindeyim .
ffmpeg
komutun tüm konsol çıkışlarını göstermelisiniz .