ffmpeg에서 x264 코덱을 사용할 때 비디오가 녹화되지 않습니다

ffmpeg에서 x264 코덱을 사용할 때 비디오가 녹화되지 않습니다

내 스크립트는 다음 명령을 사용하여 전체 화면을 기록합니다.

ffmpeg -f x11grab -y -r 24  -s 1366x768 -i :0.0 -f alsa -i default -vcodec libx264 out.avi

그런데 실행 후 out.avi영상은 나오지 않고 소리만 나오네요.

전체 출력은 다음과 같습니다( Ctrl+break 를 통해 C).

ffmpeg version 3.4.6-0ubuntu0.18.04.1 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.3.0-16ubuntu3)
  configuration: --prefix=/usr --extra-version=0ubuntu0.18.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libavresample   3.  7.  0 /  3.  7.  0
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
[x11grab @ 0x56271f542e00] Stream #0: not enough frames to estimate rate; consider increasing probesize
Input #0, x11grab, from ':0.0':
  Duration: N/A, start: 1592158154.433194, bitrate: N/A
    Stream #0:0: Video: rawvideo (BGR[0] / 0x524742), bgr0, 1366x768, 24 fps, 1000k tbr, 1000k tbn, 1000k tbc
Guessed Channel Layout for Input Stream #1.0 : stereo
Input #1, alsa, from 'default':
  Duration: N/A, start: 1592158154.486958, bitrate: 1536 kb/s
    Stream #1:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
  Stream #1:0 -> #0:1 (pcm_s16le (native) -> mp3 (libmp3lame))
Press [q] to stop, [?] for help
[swscaler @ 0x56271f57d220] Warning: data is not aligned! This can lead to a speed loss
[libx264 @ 0x56271f56c8c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x56271f56c8c0] profile High 4:4:4 Predictive, level 3.2, 4:4:4 8-bit
[alsa @ 0x56271f54cd20] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
Output #0, avi, to 'out.avi':
  Metadata:
    ISFT            : Lavf57.83.100
    Stream #0:0: Video: h264 (libx264) (H264 / 0x34363248), yuv444p(progressive), 1366x768, q=-1--1, 24 fps, 24 tbn, 24 tbc
    Metadata:
      encoder         : Lavc57.107.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream #0:1: Audio: mp3 (libmp3lame) (U[0][0][0] / 0x0055), 48000 Hz, stereo, s16p
    Metadata:
      encoder         : Lavc57.107.100 libmp3lame
frame=   14 fps=0.0 q=0.0 size=      10kB time=00:00:00.00 bitrate=N/A speed=   frame=   26 fps= 26 q=0.0 size=      10kB time=00:00:00.00 bitrate=N/A speed=   frame=   38 fps= 25 q=0.0 size=      10kB time=00:00:00.00 bitrate=N/A speed=   frame=   50 fps= 25 q=0.0 size=      10kB time=00:00:00.00 bitrate=N/A speed=   frame=   62 fps= 25 q=28.0 size=      10kB time=00:00:00.16 bitrate= 476.2kbits/frame=   74 fps= 24 q=28.0 size=      10kB time=00:00:00.67 bitrate= 118.1kbits/frame=   80 fps= 22 q=-1.0 Lsize=     516kB time=00:00:03.25 bitrate=1301.2kbits/s speed=0.906x    
video:487kB audio:16kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 2.520141%
[libx264 @ 0x56271f56c8c0] frame I:1     Avg QP:19.01  size:112157
[libx264 @ 0x56271f56c8c0] frame P:20    Avg QP:16.66  size: 18812
[libx264 @ 0x56271f56c8c0] frame B:59    Avg QP:21.03  size:   181
[libx264 @ 0x56271f56c8c0] consecutive B-frames:  1.2%  0.0%  3.8% 95.0%
[libx264 @ 0x56271f56c8c0] mb I  I16..4: 44.2%  0.0% 55.8%
[libx264 @ 0x56271f56c8c0] mb P  I16..4:  2.4%  0.0%  5.3%  P16..4:  2.4%  0.5%  0.4%  0.0%  0.0%    skip:89.0%
[libx264 @ 0x56271f56c8c0] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  4.4%  0.0%  0.0%  direct: 0.0%  skip:95.5%  L0:39.8% L1:58.9% BI: 1.3%
[libx264 @ 0x56271f56c8c0] coded y,u,v intra: 48.6% 8.6% 8.0% inter: 0.2% 0.0% 0.0%
[libx264 @ 0x56271f56c8c0] i16 v,h,dc,p: 55% 41%  3%  1%
[libx264 @ 0x56271f56c8c0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 33% 25% 17%  2%  5%  4%  5%  4%  4%
[libx264 @ 0x56271f56c8c0] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x56271f56c8c0] ref P L0: 71.9% 13.0% 12.4%  2.6%
[libx264 @ 0x56271f56c8c0] ref B L0: 77.7% 21.7%  0.6%
[libx264 @ 0x56271f56c8c0] ref B L1: 96.0%  4.0%
[libx264 @ 0x56271f56c8c0] kb/s:1197.83
Exiting normally, received signal 2.

저도 설치해서 x264포장 libx264-152해 봤습니다.

저는 KDE Neon 5.19(Ubuntu 18.04)를 사용하고 있습니다.

미리 감사드립니다.

답변1

스크린캐스트를 재생하는 데 사용하는 앱에 따라 다릅니다. VLC는 "하드웨어 가속기가 이미지를 디코딩할 수 없습니다"라는 이유로 실패했습니다.

"X11 비디오 출력(XCB)"으로 변경하면 2개의 디스플레이 설정으로 인해 비디오 오프셋이 보입니다... 프레임이 캡처되지만 코덱이 이상해 보입니다. High 4:4:4 Predictive@L3프로필 변경이 작동하지 않아서 ffmeg를 사용하는 것 같습니다. XCB. FFMPEG 문서

관련 정보