[FFmpeg-user] (no subject)
Leonardo
lsbplsb at yahoo.com
Tue Jun 30 04:46:48 EEST 2020
Hello,
I'm trying to use ffmpeg to record the computer screen and also audio from microfone. Googling I found a lot of "how to". Although I can now record, I do have a few questions (3):
1) Using command
$ ffmpeg -thread_queue_size 512 -f alsa -ac 2 -ar 44100 -i hw:0,0 -video_size 1024x768 -probesize 10M -framerate 30 -thread_queue_size 512 -f x11grab -i :0.0 -c:a aac -c:v libx264 -vf "format=yuv420p" output.mp4
ffmpeg version N-98341-gcca982ee01 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 8 (Debian 8.3.0-6)
configuration: --toolchain=hardened --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
libavutil 56. 55.100 / 56. 55.100
libavcodec 58. 93.100 / 58. 93.100
libavformat 58. 47.100 / 58. 47.100
libavdevice 58. 11.100 / 58. 11.100
libavfilter 7. 86.100 / 7. 86.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 8.100 / 5. 8.100
libswresample 3. 8.100 / 3. 8.100
libpostproc 55. 8.100 / 55. 8.100
Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, alsa, from 'hw:0,0':
Duration: N/A, start: 1593480535.223265, bitrate: 1411 kb/s
Stream #0:0: Audio: pcm_s16le, 44100 Hz, stereo, s16, 1411 kb/s
Input #1, x11grab, from ':0.0':
Duration: N/A, start: 1593480535.257288, bitrate: 754974 kb/s
Stream #1:0: Video: rawvideo (BGR[0] / 0x524742), bgr0, 1024x768, 754974 kb/s, 30 fps, 30 tbr, 1000k tbn, 1000k tbc
Stream mapping:
Stream #1:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
Stream #0:0 -> #0:1 (pcm_s16le (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 @ 0x55a51bf2fb00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x55a51bf2fb00] profile High, level 3.1
[libx264 @ 0x55a51bf2fb00] 264 - core 155 r2917 0a84d98 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'output.mp4':
Metadata:
encoder : Lavf58.47.100
Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p(progressive), 1024x768, q=-1--1, 30 fps, 15360 tbn, 30 tbc
Metadata:
encoder : Lavc58.93.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s
Metadata:
encoder : Lavc58.93.100 aac
frame= 19 fps=0.0 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A speed= frame= 34 fps= 34 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A speed= frame= 49 fps= 32 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A speed= frame= 64 fps= 32 q=29.0 size= 0kB time=00:00:00.39 bitrate= 1.0kbits/frame= 79 fps= 31 q=29.0 size= 0kB time=00:00:00.90 bitrate= 0.4kbits/frame= 95 fps= 31 q=29.0 size= 0kB time=00:00:01.40 bitrate= 0.3kbits/frame= 110 fps= 31 q=29.0 size= 0kB time=00:00:01.90 bitrate= 0.2kbits/frame= 125 fps= 31 q=29.0 size= 0kB time=00:00:02.40 bitrate= 0.2kbits/frame= 140 fps= 31 q=29.0 size= 0kB time=00:00:02.92 bitrate= 0.1kbits/frame= 156 fps= 31 q=29.0 size= 0kB time=00:00:03.43 bitrate= 0.1kbits/frame= 162 fps= 28 q=-1.0 Lsize= 208kB time=00:00:05.30 bitrate= 321.1kbits/s speed=0.93x
video:143kB audio:59kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 3.221925%
[libx264 @ 0x55a51bf2fb00] frame I:1 Avg QP:18.42 size: 90858
[libx264 @ 0x55a51bf2fb00] frame P:41 Avg QP:13.42 size: 1010
[libx264 @ 0x55a51bf2fb00] frame B:120 Avg QP:18.59 size: 108
[libx264 @ 0x55a51bf2fb00] consecutive B-frames: 1.2% 0.0% 0.0% 98.8%
[libx264 @ 0x55a51bf2fb00] mb I I16..4: 16.9% 30.2% 53.0%
[libx264 @ 0x55a51bf2fb00] mb P I16..4: 0.1% 0.1% 0.2% P16..4: 0.7% 0.2% 0.2% 0.0% 0.0% skip:98.5%
[libx264 @ 0x55a51bf2fb00] mb B I16..4: 0.3% 0.0% 0.0% B16..8: 2.0% 0.0% 0.0% direct: 0.0% skip:97.7% L0:55.2% L1:44.8% BI: 0.0%
[libx264 @ 0x55a51bf2fb00] 8x8 transform intra:24.1% inter:12.2%
[libx264 @ 0x55a51bf2fb00] coded y,uvDC,uvAC intra: 37.0% 0.2% 0.0% inter: 0.1% 0.0% 0.0%
[libx264 @ 0x55a51bf2fb00] i16 v,h,dc,p: 55% 36% 3% 5%
[libx264 @ 0x55a51bf2fb00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 33% 32% 21% 1% 4% 2% 4% 0% 4%
[libx264 @ 0x55a51bf2fb00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 42% 27% 9% 3% 4% 4% 4% 4% 4%
[libx264 @ 0x55a51bf2fb00] i8c dc,h,v,p: 97% 3% 0% 0%
[libx264 @ 0x55a51bf2fb00] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x55a51bf2fb00] ref P L0: 87.1% 5.6% 5.9% 1.5%
[libx264 @ 0x55a51bf2fb00] ref B L0: 22.1% 77.3% 0.6%
[libx264 @ 0x55a51bf2fb00] ref B L1: 95.8% 4.2%
[libx264 @ 0x55a51bf2fb00] kb/s:215.20
[aac @ 0x55a51bf31200] Qavg: 214.820
Exiting normally, received signal 2.
last 2 seconds of output.mp4 has no sound at all. Similar issue reported at
https://trac.ffmpeg.org/ticket/5900
To diminish the issue, I added "-preset ultrafast" to the above command and now the only last 0.2s has no sound (fine with this)
Question: is there a reason for this "sound issue" when ultrafast is not used?
2) Is this the correct way to use Hardware Aceleration?
$ ffmpeg -thread_queue_size 512 -f alsa -ac 2 -ar 44100 -i hw:0,0 -vaapi_device /dev/dri/renderD128 -video_size 1024x768 -probesize 10M -framerate 30 -thread_queue_size 512 -f x11grab -i :0.0 -c:a aac -c:v h264_vaapi -vf "format=nv12,hwupload" output_hw.mp4
ffmpeg version N-98341-gcca982ee01 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 8 (Debian 8.3.0-6)
configuration: --toolchain=hardened --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
libavutil 56. 55.100 / 56. 55.100
libavcodec 58. 93.100 / 58. 93.100
libavformat 58. 47.100 / 58. 47.100
libavdevice 58. 11.100 / 58. 11.100
libavfilter 7. 86.100 / 7. 86.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 8.100 / 5. 8.100
libswresample 3. 8.100 / 3. 8.100
libpostproc 55. 8.100 / 55. 8.100
Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, alsa, from 'hw:0,0':
Duration: N/A, start: 1593480832.865073, bitrate: 1411 kb/s
Stream #0:0: Audio: pcm_s16le, 44100 Hz, stereo, s16, 1411 kb/s
Input #1, x11grab, from ':0.0':
Duration: N/A, start: 1593480832.898990, bitrate: 754974 kb/s
Stream #1:0: Video: rawvideo (BGR[0] / 0x524742), bgr0, 1024x768, 754974 kb/s, 30 fps, 30 tbr, 1000k tbn, 1000k tbc
Stream mapping:
Stream #1:0 -> #0:0 (rawvideo (native) -> h264 (h264_vaapi))
Stream #0:0 -> #0:1 (pcm_s16le (native) -> aac (native))
Press [q] to stop, [?] for help
[h264_vaapi @ 0x55b46c504a80] No quality level set; using default (20).
Output #0, mp4, to 'output_hw.mp4':
Metadata:
encoder : Lavf58.47.100
Stream #0:0: Video: h264 (h264_vaapi) (High) (avc1 / 0x31637661), vaapi_vld(progressive), 1024x768, q=-1--1, 30 fps, 15360 tbn, 30 tbc
Metadata:
encoder : Lavc58.93.100 h264_vaapi
Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s
Metadata:
encoder : Lavc58.93.100 aac
frame= 19 fps=0.0 q=-0.0 size= 0kB time=00:00:00.51 bitrate= 0.8kbits/frame= 34 fps= 33 q=-0.0 size= 0kB time=00:00:01.00 bitrate= 0.4kbits/frame= 49 fps= 32 q=-0.0 size= 256kB time=00:00:01.53 bitrate=1368.7kbits/frame= 65 fps= 32 q=-0.0 size= 256kB time=00:00:02.04 bitrate=1026.5kbits/frame= 80 fps= 32 q=-0.0 size= 256kB time=00:00:02.53 bitrate= 828.0kbits/frame= 95 fps= 31 q=-0.0 size= 256kB time=00:00:03.04 bitrate= 689.6kbits/frame= 110 fps= 31 q=-0.0 size= 256kB time=00:00:03.53 bitrate= 593.6kbits/frame= 125 fps= 31 q=-0.0 size= 512kB time=00:00:04.04 bitrate=1038.2kbits/frame= 140 fps= 31 q=-0.0 size= 512kB time=00:00:04.57 bitrate= 917.0kbits/frame= 155 fps= 31 q=-0.0 size= 512kB time=00:00:05.06 bitrate= 828.7kbits/frame= 171 fps= 31 q=-0.0 size= 768kB time=00:00:05.57 bitrate=1129.0kbits/frame= 186 fps= 31 q=-0.0 size= 768kB time=00:00:06.06 bitrate=1037.1kbits/frame= 201 fps= 30 q=-0.0 size= 768kB time=00:00:06.59 bitrate= 954.1kbits/frame= 217 fps= 31 q=-0.0 size= 768kB time=00:00:07.10 bitrate= 885.5kbits/frame= 232 fps= 31 q=-0.0 size= 768kB time=00:00:07.60 bitrate= 827.9kbits/frame= 237 fps= 30 q=-0.0 Lsize= 1029kB time=00:00:07.83 bitrate=1076.3kbits/s speed= 1x
video:896kB audio:123kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.009003%
[aac @ 0x55b46c505bc0] Qavg: 214.335
Exiting normally, received signal 2.
3) Are those commands above "correct"? I mean, is there something "wrong" or can it be improved to reduce file size, improve video quality or sound quality? I know that ffmpeg has tons of options and "improve" is not a clear question.
Kind regards,
Leonardo
More information about the ffmpeg-user
mailing list