in the same context before, I have been helped by brother ( llogan ) on Oct 15 at 16:35 , by using syntax his suggestion, and i've tried it, at first i got the sound stuttering, then it went back to silent,but for some reason I haven't accessed this blog for a long time, so communication is loss, so anyone can help me ?
current condition we using syntax :
ffmpeg -f alsa -channels 2 -sample_rate 44100 -i hw:0 -f video4linux2 -i /dev/video0 -c:a aac -b:a 128k -c:v libx264 -preset veryfast -b:v 4000k -maxrate 4000k -bufsize 12000k -g 10 -vf "scale=1280:720,format=yuv420p" -f flv rtmp://localhost/show/stream
and i have informati running from ffmpeg :
[alsa @ 0x556854b35c60] ALSA buffer xrun.
frame= 237 fps=5.0 q=13.0 size= 21447kB time=00:00:43.23 bitrate=4063.4kbits/s speed=0.9
frame= 239 fps=5.0 q=13.0 size= 21633kB time=00:00:43.23 bitrate=4098.6kbits/s speed=0.9
[alsa @ 0x556854b35c60] ALSA buffer xrun.
frame= 242 fps=5.0 q=13.0 size= 21932kB time=00:00:44.23 bitrate=4061.5kbits/s speed=0.9
frame= 244 fps=5.0 q=13.0 size= 22124kB time=00:00:44.23 bitrate=4097.1kbits/s speed=0.9
is something wrong?, and we stop the encoder have a information is :
[flv @ 0x5585283c6a40] Failed to update header with correct duration.
[flv @ 0x5585283c6a40] Failed to update header with correct filesize.
frame=428826 fps=5.0 q=-1.0 Lsize=40706449kB time=23:49:20.70 bitrate=3888.1kbits/s speed=0.958x
video:428826kB audio:767kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.025860%
[libx264 @ 0x5585283c8200] frame I:57274 Avg QP: 7.20 size:151544
[libx264 @ 0x5585283c8200] frame P:263139 Avg QP: 10.57 size:96778
[libx264 @ 0x5585283c8200] frame B:108413 Avg QP:10.50 size: 69423
[libx264 @ 0x5585283c8200] consecutive B-frames: 63.0% 7.8% 6.5% 22.7%
[libx264 @ 0x5585283c8200] mb I I16..4: 14.2% 12.6% 73.2%
[libx264 @ 0x5585283c8200] mb P I16..4: 12.6% 11.5% 27.5% P16..4: 8.2% 17.2% 20.3% 0.0% 0.0% skip: 2.7%
[libx264 @ 0x5585283c8200] mb B I16..4: 4.2% 2.4% 4.7% B16..8: 23.7% 26.8% 14.9% direct:14.1% skip:9.1% L0:36.9% L1:34.7% BI:28.4%
[libx264 @ 0x5585283c8200] 8x8 transform intra:19.5% inter:35.3%
[libx264 @ 0x5585283c8200] coded y,uvDC,uvAC intra: 83.4% 88.7% 85.2% inter: 78.4% 76.8% 46.4%
[libx264 @ 0x5585283c8200] i16 v,h,dc,p: 45% 40% 10% 5%
[libx264 @ 0x5585283c8200] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 25% 41% 12% 3% 3% 3% 5% 3% 5%
[libx264 @ 0x5585283c8200] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 26% 34% 8% 4% 6% 5% 6% 5% 6%
[libx264 @ 0x5585283c8200] i8c dc,h,v,p: 34% 35% 18% 13%
[libx264 @ 0x5585283c8200] Weighted P-Frames: Y:2.6% UV:1.9%
[libx264 @ 0x5585283c8200] kb/s:3887.06
[aac @ 0x5585283cc760] Qavg: 65536.000
s710@sensorsip:~$
We first start the ffmpg msg is :
s710@sensorsip:~$ ffmpeg -f alsa -channels 2 -sample_rate 44100 -i hw:0 -f video4linux2 -i /dev/video0 -c:a aac -b:a 128k -c:v libx264 -preset veryfast -b:v 4000k -maxrate 4000k -bufsize 12000k -g 10 -vf "scale=1280:720,format=yuv420p" -f flv rtmp://localhost/show/stream
ffmpeg version 3.4.8-0ubuntu0.2 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
configuration: --prefix=/usr --extra-version=0ubuntu0.2 --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
Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, alsa, from 'hw:0':
Duration: N/A, start: 1635926018.864251, bitrate: 1411 kb/s
Stream #0:0: Audio: pcm_s16le, 44100 Hz, stereo, s16, 1411 kb/s
Input #1, video4linux2,v4l2, from '/dev/video0':
Duration: N/A, start: 89255.399764, bitrate: 165888 kb/s
Stream #1:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 1920x1080, 165888 kb/s, 5 fps, 5 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
[alsa @ 0x5585283b2c60] ALSA buffer xrun.
[libx264 @ 0x5585283c8200] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
[libx264 @ 0x5585283c8200] profile High, level 3.1
[libx264 @ 0x5585283c8200] 264 - core 152 r2854 e9a5903 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=1 ref=1 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=2 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=6 lookahead_threads=2 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=1 keyint=10 keyint_min=1 scenecut=40 intra_refresh=0 rc_lookahead=10 rc=cbr mbtree=1 bitrate=4000 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=4000 vbv_bufsize=12000 nal_hrd=none filler=0 ip_ratio=1.40 aq=1:1.00
Output #0, flv, to 'rtmp://localhost/show/stream':
Metadata:
encoder : Lavf57.83.100
Stream #0:0: Video: h264 (libx264) ([7][0][0][0] / 0x0007), yuv420p(progressive), 1280x720, q=-1--1, 4000 kb/s, 5 fps, 1k tbn, 5 tbc
Metadata:
encoder : Lavc57.107.100 libx264
Side data:
cpb: bitrate max/min/avg: 4000000/0/4000000 buffer size: 12000000 vbv_delay: -1
Stream #0:1: Audio: aac (LC) ([10][0][0][0] / 0x000A), 44100 Hz, stereo, fltp, 128 kb/s
Metadata:
encoder : Lavc57.107.100 aac
[alsa @ 0x5585283b2c60] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
So where is the validity huh ?, is the CPU hardware too low ? , my spec CPU is Intel i5 Gen 2, Ram 8Gb , SSD 500GB ( Futjisu lifebook S Series S710 ), OS ubuntu 18.4 ( I just started learning on Linux )
I see from VLC the captured audio codec is ADTS and static is also there, but there is no sound, If I remember correctly, when I shutdown HLS Server, at the last second there was a sound and die the stream.
I try to capture information in VLC like this :
codec audio captured on VLC
statistics capture on VLC
if my problem is in the hardware aspect, is it possible to add an NVEDIA GPU card with the help of using the CUDA hardware accelerator, can it be solved?
we running aplay -l and v4l2-ctl --list-device msg is :
**** List of PLAYBACK Hardware Devices ****
card 0: MID [HDA Intel MID], device 0: ALC269 Analog [ALC269 Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: MID [HDA Intel MID], device 3: HDMI 0 [HDMI 0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: MID [HDA Intel MID], device 7: HDMI 1 [HDMI 1]
Subdevices: 1/1
Subdevice #0: subdevice #0
s710@sensorsip:~$ v4l2-ctl --list-device
USB Video: USB Video (usb-0000:00:1a.0-1.2):
/dev/video0
USB Video: USB Video (usb-0000:00:1a.0-1.3):
/dev/video1
USB Webcam: USB Webcam (usb-0000:00:1d.0-1.3):
/dev/video2
we using now is USB Video 0 using command is HW:0
Thanks for your help..
regards,
Christian Hung