[Libav-user] Writing Audio AVPacket without resampling

sebastian.wichmann at karlsruhe-it-solutions.com sebastian.wichmann at karlsruhe-it-solutions.com
Mon Mar 23 09:51:40 EET 2020


Hello,

>> I'm sorry for the bad worded question. Its hard to write a question if you don't fully understand the matter.
>And even more difficult to answer...
I'm sorry about that, I'll try to word my questions better the next time.

> > > Since your (original) issue is "too slow":
> > > Did you already test with ffmpeg (the cli)?
> > > If it fast enough to do what you want, you should be able to do the same programmatically.
> > Yes the standalone application is able to record the audio and video in real time.
> If you show us the command line you tested together with the complete, uncut console output, we can answer if resampling will be necessary.

The command looks like this:
ffmpeg -f gdigrab -framerate 30 -i desktop -f dshow -i audio="Mikrofon (Realtek High Definition Audio)" test.mp4

The console output looks like this:
ffmpeg version 4.1.3 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 8.3.1 (GCC) 20190414
  configuration: --disable-static --enable-shared --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
  libavutil      56. 22.100 / 56. 22.100
  libavcodec     58. 35.100 / 58. 35.100
  libavformat    58. 20.100 / 58. 20.100
  libavdevice    58.  5.100 / 58.  5.100
  libavfilter     7. 40.101 /  7. 40.101
  libswscale      5.  3.100 /  5.  3.100
  libswresample   3.  3.100 /  3.  3.100
  libpostproc    55.  3.100 / 55.  3.100
[gdigrab @ 0000022a0bc6e580] Capturing whole desktop as 1366x768x32 at (0,0)
[gdigrab @ 0000022a0bc6e580] Stream #0: not enough frames to estimate rate; consider increasing probesize
Input #0, gdigrab, from 'desktop':
  Duration: N/A, start: 1584949529.887344, bitrate: 1007137 kb/s
    Stream #0:0: Video: bmp, bgra, 1366x768, 1007137 kb/s, 30 fps, 1000k tbr, 1000k tbn, 1000k tbc
Guessed Channel Layout for Input Stream #1.0 : stereo
Input #1, dshow, from 'audio=Mikrofon (Realtek High Definition Audio)':
  Duration: N/A, start: 400094.071000, bitrate: 1411 kb/s
    Stream #1:0: Audio: pcm_s16le, 44100 Hz, stereo, s16, 1411 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (bmp (native) -> h264 (libx264))
  Stream #1:0 -> #0:1 (pcm_s16le (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 @ 0000022a0bcea840] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0000022a0bcea840] profile High 4:4:4 Predictive, level 3.2, 4:4:4, 8-bit
[libx264 @ 0000022a0bcea840] 264 - core 157 r2970 5493be8 - H.264/MPEG-4 AVC codec - Copyleft 2003-2019 - 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=4 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 'test.mp4':
  Metadata:
    encoder         : Lavf58.20.100
    Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv444p(progressive), 1366x768, q=-1--1, 30 fps, 15360 tbn, 30 tbc
    Metadata:
      encoder         : Lavc58.35.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s
    Metadata:
      encoder         : Lavc58.35.100 aac
[gdigrab @ 0000022a0bc6e580] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
frame=  354 fps= 32 q=-1.0 Lsize=    1050kB time=00:00:11.70 bitrate= 735.5kbits/s dup=41 drop=0 speed=1.06x
video:872kB audio:165kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.262673%
[libx264 @ 0000022a0bcea840] frame I:2     Avg QP:19.05  size:232061
[libx264 @ 0000022a0bcea840] frame P:89    Avg QP:19.14  size:  4440
[libx264 @ 0000022a0bcea840] frame B:263   Avg QP:27.81  size:   126
[libx264 @ 0000022a0bcea840] consecutive B-frames:  0.8%  0.0%  0.8% 98.3%
[libx264 @ 0000022a0bcea840] mb I  I16..4: 38.5% 19.4% 42.1%
[libx264 @ 0000022a0bcea840] mb P  I16..4:  0.3%  0.5%  0.6%  P16..4:  1.6%  0.2%  0.1%  0.0%  0.0%    skip:96.7%
[libx264 @ 0000022a0bcea840] mb B  I16..4:  0.0%  0.1%  0.0%  B16..8:  2.3%  0.0%  0.0%  direct: 0.0%  skip:97.6%  L0:61.7% L1:38.2% BI: 0.1%
[libx264 @ 0000022a0bcea840] 8x8 transform intra:28.6% inter:43.9%
[libx264 @ 0000022a0bcea840] coded y,u,v intra: 31.3% 28.0% 27.6% inter: 0.1% 0.0% 0.0%
[libx264 @ 0000022a0bcea840] i16 v,h,dc,p: 31% 66%  3%  0%
[libx264 @ 0000022a0bcea840] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 34% 24% 36%  1%  0%  0%  0%  0%  4%
[libx264 @ 0000022a0bcea840] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 33% 26% 17%  2%  3%  4%  6%  3%  6%
[libx264 @ 0000022a0bcea840] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0000022a0bcea840] ref P L0: 33.5%  3.6% 44.4% 18.5%
[libx264 @ 0000022a0bcea840] ref B L0: 41.4% 55.7%  2.9%
[libx264 @ 0000022a0bcea840] ref B L1: 95.1%  4.9%
[libx264 @ 0000022a0bcea840] kb/s:605.09
[aac @ 0000022a0bcec780] Qavg: 243.525

Best regards,
Sebastian Wichmann



More information about the Libav-user mailing list