Can you post the ffmpeg output with audio input in the command line Sent from my iPhone
On 13. Feb 2021, at 11:21, Mike Soultanian <[email protected]> wrote: CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe. On 2/13/2021 1:54 AM, Gisbert Haas wrote: can you post the full output please. Sorry, I didn't include it because when I have audio it doesn't work. I have tried -f alsa -i with the following: plughw:2,0, hw:CARD=capture,DEV=0, and plughw:CARD=capture,DEV=0 and none of them seem to work - I could very well be using them incorrectly. If you're able to tell when I should be using after "-i" for the sound, I'll give it a try. Here is the output from various commands (ezcap is my USB capture card): pi@raspberrypi:~ $ cat /proc/asound/devices 0: [ 0] : control 16: [ 0- 0]: digital audio playback 32: [ 1] : control 33: : timer 48: [ 1- 0]: digital audio playback 64: [ 2] : control 88: [ 2- 0]: digital audio capture pi@raspberrypi:~ $ arecord -L default Playback/recording through the PulseAudio sound server null Discard all samples (playback) or generate zero samples (capture) jack JACK Audio Connection Kit pulse PulseAudio Sound Server usbstream:CARD=b1 bcm2835 HDMI 1 USB Stream Output usbstream:CARD=Headphones bcm2835 Headphones USB Stream Output sysdefault:CARD=capture ezcap U3 capture, USB Audio Default Audio Device front:CARD=capture,DEV=0 ezcap U3 capture, USB Audio Front speakers surround21:CARD=capture,DEV=0 ezcap U3 capture, USB Audio 2.1 Surround output to Front and Subwoofer speakers surround40:CARD=capture,DEV=0 ezcap U3 capture, USB Audio 4.0 Surround output to Front and Rear speakers surround41:CARD=capture,DEV=0 ezcap U3 capture, USB Audio 4.1 Surround output to Front, Rear and Subwoofer speakers surround50:CARD=capture,DEV=0 ezcap U3 capture, USB Audio 5.0 Surround output to Front, Center and Rear speakers surround51:CARD=capture,DEV=0 ezcap U3 capture, USB Audio 5.1 Surround output to Front, Center, Rear and Subwoofer speakers surround71:CARD=capture,DEV=0 ezcap U3 capture, USB Audio 7.1 Surround output to Front, Center, Side, Rear and Woofer speakers iec958:CARD=capture,DEV=0 ezcap U3 capture, USB Audio IEC958 (S/PDIF) Digital Audio Output dmix:CARD=capture,DEV=0 ezcap U3 capture, USB Audio Direct sample mixing device dsnoop:CARD=capture,DEV=0 ezcap U3 capture, USB Audio Direct sample snooping device hw:CARD=capture,DEV=0 ezcap U3 capture, USB Audio Direct hardware device without any conversions plughw:CARD=capture,DEV=0 ezcap U3 capture, USB Audio Hardware device with all software conversions usbstream:CARD=capture ezcap U3 capture USB Stream Output pi@raspberrypi:~ $ arecord -l **** List of CAPTURE Hardware Devices **** card 2: capture [ezcap U3 capture], device 0: USB Audio [USB Audio] Subdevices: 1/1 Subdevice #0: subdevice #0 And here is the command and output for when it works (without sound - if you can help me form the correct audio input syntax, I'll gladly try it and post the output): pi@raspberrypi:~ $ v4l2-ctl --set-fmt-video=width=1280,height=720 && ffmpeg -f v4l2 -thread_queue_size 384 -video_size 1280x720 -framerate 30 -i /dev/video0 -c:v h264_omx -preset veryfast -b:v 1984k -maxrate 1984k -bufsize 3968k -vf "format=yuv420p" -g 60 -c:a aac -b:a 128k -ar 44100 -f flv rtmp://sfo.contribute.live-video.net/app/ ffmpeg version N-101069-g000b250 Copyright (c) 2000-2021 the FFmpeg developers built with gcc 8 (Raspbian 8.3.0-6+rpi1) configuration: --prefix=/home/pi/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/pi/ffmpeg_build/include --extra-ldflags=-L/home/pi/ffmpeg_build/lib --extra-libs='-lpthread -lm' --bindir=/home/pi/bin --enable-gpl --enable-gnutls --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libsvtav1 --enable-libdav1d --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-omx --enable-omx-rpi --enable-nonfree libavutil 56. 65.100 / 56. 65.100 libavcodec 58.122.100 / 58.122.100 libavformat 58. 67.100 / 58. 67.100 libavdevice 58. 11.103 / 58. 11.103 libavfilter 7.106.100 / 7.106.100 libswscale 5. 8.100 / 5. 8.100 libswresample 3. 8.100 / 3. 8.100 libpostproc 55. 8.100 / 55. 8.100 [video4linux2,v4l2 @ 0x327d420] Dequeued v4l2 buffer contains corrupted data (0 bytes). Input #0, video4linux2,v4l2, from '/dev/video0': Duration: N/A, start: 0.000000, bitrate: 442368 kb/s Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 1280x720, 442368 kb/s, 30 fps, 30 tbr, 1000k tbn, 1000k tbc Codec AVOption preset (Encoding preset [0, 8]) specified for output file #0 (rtmp://sfo.contribute.live-video.net/app/) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream. Stream mapping: Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (h264_omx)) Press [q] to stop, [?] for help [video4linux2,v4l2 @ 0x327d420] Dequeued v4l2 buffer contains corrupted data (0 bytes). Last message repeated 30 times [h264_omx @ 0x32817b0] Using OMX.broadcom.video_encode Output #0, flv, to 'rtmp://sfo.contribute.live-video.net/app/': Metadata: encoder : Lavf58.67.100 Stream #0:0: Video: h264 ([7][0][0][0] / 0x0007), yuv420p(tv, progressive), 1280x720, q=2-31, 1984 kb/s, 30 fps, 1k tbn Metadata: encoder : Lavc58.122.100 h264_omx [flv @ 0x3280360] Failed to update header with correct duration.ate= 37.0kbits/s speed=48.2x [flv @ 0x3280360] Failed to update header with correct filesize. frame= 1377 fps= 27 q=-0.0 Lsize= 11138kB time=00:40:49.76 bitrate= 37.2kbits/s speed=47.9x video:11111kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.244566% Exiting normally, received signal 2. pi@raspberrypi:~ $ v4l2-ctl --set-fmt-video=width=1280,height=720 && ffmpeg -f v4l2 -thread_queue_size 384 -video_size 1280x720 -framerate 30 -i /dev/video0 -c:v libx264 -preset veryfast -b:v 1984k -maxrate 1984k -bufsize 3968k -vf "format=yuv420p" -g 60 -c:a aac -b:a 128k -ar 44100 -f flv rtmp://sfo.contribute.live-video.net/app/ ffmpeg version N-101069-g000b250 Copyright (c) 2000-2021 the FFmpeg developers built with gcc 8 (Raspbian 8.3.0-6+rpi1) configuration: --prefix=/home/pi/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/pi/ffmpeg_build/include --extra-ldflags=-L/home/pi/ffmpeg_build/lib --extra-libs='-lpthread -lm' --bindir=/home/pi/bin --enable-gpl --enable-gnutls --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libsvtav1 --enable-libdav1d --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-omx --enable-omx-rpi --enable-nonfree libavutil 56. 65.100 / 56. 65.100 libavcodec 58.122.100 / 58.122.100 libavformat 58. 67.100 / 58. 67.100 libavdevice 58. 11.103 / 58. 11.103 libavfilter 7.106.100 / 7.106.100 libswscale 5. 8.100 / 5. 8.100 libswresample 3. 8.100 / 3. 8.100 libpostproc 55. 8.100 / 55. 8.100 [video4linux2,v4l2 @ 0x2756420] Dequeued v4l2 buffer contains corrupted data (0 bytes). Input #0, video4linux2,v4l2, from '/dev/video0': Duration: N/A, start: 0.000000, bitrate: 442368 kb/s Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 1280x720, 442368 kb/s, 30 fps, 30 tbr, 1000k tbn, 1000k tbc Stream mapping: Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264)) Press [q] to stop, [?] for help [video4linux2,v4l2 @ 0x2756420] Dequeued v4l2 buffer contains corrupted data (0 bytes). Last message repeated 30 times [libx264 @ 0x275a7b0] using cpu capabilities: ARMv6 NEON [libx264 @ 0x275a7b0] profile High, level 3.1 [libx264 @ 0x275a7b0] 264 - core 146 - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - 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=60 keyint_min=6 scenecut=40 intra_refresh=0 rc_lookahead=10 rc=cbr mbtree=1 bitrate=1984 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=1984 vbv_bufsize=3968 nal_hrd=none filler=0 ip_ratio=1.40 aq=1:1.00 Output #0, flv, to 'rtmp://sfo.contribute.live-video.net/app/': Metadata: encoder : Lavf58.67.100 Stream #0:0: Video: h264 ([7][0][0][0] / 0x0007), yuv420p(tv, progressive), 1280x720, q=2-31, 1984 kb/s, 30 fps, 1k tbn Metadata: encoder : Lavc58.122.100 libx264 Side data: cpb: bitrate max/min/avg: 1984000/0/1984000 buffer size: 3968000 vbv_delay: N/A [flv @ 0x2759360] Failed to update header with correct duration.ate= 38.1kbits/s speed=47.2x [flv @ 0x2759360] Failed to update header with correct filesize. frame= 1468 fps= 27 q=-1.0 Lsize= 12026kB time=00:42:21.43 bitrate= 38.8kbits/s speed=46.8x << this line counts up until I hit q video:11997kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.241407% [libx264 @ 0x275a7b0] frame I:30 Avg QP:22.77 size: 35542 [libx264 @ 0x275a7b0] frame P:775 Avg QP:25.98 size: 10805 [libx264 @ 0x275a7b0] frame B:663 Avg QP:26.90 size: 4290 [libx264 @ 0x275a7b0] consecutive B-frames: 13.4% 75.9% 10.2% 0.5% [libx264 @ 0x275a7b0] mb I I16..4: 31.8% 50.5% 17.7% [libx264 @ 0x275a7b0] mb P I16..4: 12.7% 7.3% 0.4% P16..4: 38.1% 8.9% 2.7% 0.0% 0.0% skip:29.9% [libx264 @ 0x275a7b0] mb B I16..4: 1.7% 0.7% 0.0% B16..8: 13.1% 2.6% 0.2% direct:22.6% skip:59.1% L0:39.8% L1:53.3% BI: 7.0% [libx264 @ 0x275a7b0] 8x8 transform intra:37.6% inter:18.0% [libx264 @ 0x275a7b0] coded y,uvDC,uvAC intra: 24.9% 54.3% 5.3% inter: 7.1% 30.7% 0.0% [libx264 @ 0x275a7b0] i16 v,h,dc,p: 51% 24% 17% 8% [libx264 @ 0x275a7b0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 14% 19% 41% 3% 5% 4% 5% 3% 6% [libx264 @ 0x275a7b0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 22% 23% 21% 4% 8% 5% 6% 5% 7% [libx264 @ 0x275a7b0] i8c dc,h,v,p: 59% 19% 18% 3% [libx264 @ 0x275a7b0] Weighted P-Frames: Y:0.0% UV:0.0% [libx264 @ 0x275a7b0] kb/s:1990.71 Thanks! Mike On 2/13/21 1:23 AM, Mike Soultanian wrote: CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe. Hey Everyone, I'm trying to stream from my GoPro into a USB capture device through my Raspberry Pi 4 and send the feed up to Twitch or my rtmp server. After a lot of head banging I realized that there were two things that were messing me up: 1) specifying an audio input seems to break things and 2) trying to use the h264_v4l2m2m hardware encoder also seems to mess things up. After finding the ffmpeg streaming wiki here: https://trac.ffmpeg.org/wiki/EncodingForStreamingSites I was finally able to cobble this command-line together and get it working... kinda: *ffmpeg -f v4l2 -video_size 1280x720 -framerate 30 -i /dev/video0 -c:v libx264 -preset veryfast -b:v 1984k -maxrate 1984k -bufsize 3968k -vf "format=yuv420p" -g 60 -c:a aac -b:a 128k -ar 44100 -f flv rtmp://sfo.contribute.live-video.net/app/[my key]* I say kinda because I can't seem to get audio working. Now, I just want to say that using the QT v4l2 test utility I'm able to get audio and video simultaneously, so I know that the capture feed from my GoPro is healthy, and using ffmpeg I'm able to record either video from */dev/video0* or audio from *plughw:2,0*, but it seems like whenever I add *-f alsa -i plughw:2,0* in addition to *-i /dev/video0*, it won't stream anything (or record anything during my recording attempts). Am I missing something obvious here? I was hoping that I'm just doing something stupid, but even looking on that wiki listed above it looks like all I need to do is add *-f alsa -ac 2 -i plughw:2,0* and it should work, but it just seems to kill the stream or record nothing. Also, I'd love to be able to use the hardware encoder, so any thoughts on that would be appreciated, but getting both audio and video is the main priority. Btw, if you're curious about what I'm doing, I'm trying to build a DIY mobile streaming rig that I can take hangliding/paragliding with me so people can watch. I thought it would be a fun project but this portion has turned out to be quite challenging!! Thanks! Mike _______________________________________________ ffmpeg-user mailing list [email protected]<mailto:[email protected]> https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email [email protected]<mailto:[email protected]> with subject "unsubscribe". _______________________________________________ ffmpeg-user mailing list [email protected] https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email [email protected] with subject "unsubscribe".
