[FFmpeg-user] Trying to stream to rtmp from my rsp4 and a GoPro

Mike Soultanian mike at soultanian.com
Sun Feb 14 02:51:18 EET 2021


Ok, I did a lot more testing and have learned a bit more about my 
hardware and the various names of audio devices.  Also, I didn't mention 
it in the previous email, but I did recompile ffmpeg from the latest 
source.  After a bunch of research and testing I found all of these 
commands to work:

v4l2-ctl --set-fmt-video=width=1280,height=720
ffmpeg -f v4l2 -input_format yuyv422 -framerate 30 -i /dev/video0 -c:v 
libx264                -vf format=yuv420p -y Desktop/test.mp4
ffmpeg -f v4l2 -input_format yuyv422 -framerate 30 -i /dev/video0 -c:v 
h264_omx          -vf format=yuv420p -y Desktop/test.mp4
ffmpeg -f v4l2 -input_format yuyv422 -framerate 30 -i /dev/video0 -c:v 
h264_v4l2m2m -vf format=yuv420p -y Desktop/test.mp4
ffmpeg -f alsa -ac 2 -i 
hw:CARD=capture,DEV=0                                    -c:v 
h264_omx          -vf format=yuv420p -y Desktop/test.mp4

So, if I'm understanding this all correctly, I'm using the raw feed from 
my capture card and converting it into a different format utilizing the 
software encoder (first ffmpeg line above) and the hardware encoder 
(second and third lines - omx/v4l2m2m), so it looks like I figured out 
hardware encoding - one problem solved!  The first 3 ffmpeg lines 
successfully recorded video.  I was also able to successfully record 
audio in the last line above.

Now, here's where I tried to capture audio and video together:
*ffmpeg -f v4l2 -input_format yuyv422 -framerate 30 -i /dev/video0 -f 
alsa -ac 2 -i hw:CARD=capture,DEV=0 -c:v libx264 -vf format=yuv420p -y 
Desktop/test.mp4*

I let the command run for about 20 seconds.  When I play the file it has 
audio at the beginning but no video, and the audio doesn't start until 
about 5 seconds in. Eventually the audio stops and then it's just 
silence and black. What's weird is the length is 14 minutes and if I try 
and seek it will jump to the end and then briefly show some captured 
video and then stop.  So it's like I'm getting both audio and video, but 
it's not lined up and there's barely any video.  Also when the capture 
was occurring, the *time= *counter wasn't going up - it was just staying 
stuck at *time=00:14:31.46* whereas with all the individual audio or 
video captures it will count up - plus that number coincidentally is the 
length of the recorded video.  Also, the frame rate is super low with 
the above audio/video ffmpeg line whereas it hangs out in the high 20s 
when just recording video, probably because it's actually recording 
video correctly...

Here is the full output from the failed video/audio capture (I hit q 
after about 20 seconds):

*pi at raspberrypi:~ $ ffmpeg -f v4l2 -input_format yuyv422 -framerate 30 
-i /dev/video0 -f alsa -ac 2 -i hw:CARD=capture,DEV=0 -c:v libx264 -vf 
format=yuv420p -y Desktop/test.mp4*
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 @ 0x3b3e390] 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
Guessed Channel Layout for Input Stream #1.0 : stereo
Input #1, alsa, from 'hw:CARD=capture,DEV=0':
   Duration: N/A, start: 1613261965.042902, 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) -> aac (native))
Press [q] to stop, [?] for help
[video4linux2,v4l2 @ 0x3b3e390] Dequeued v4l2 buffer contains corrupted 
data (0 bytes).
     Last message repeated 30 times
[libx264 @ 0x3b56fe0] using cpu capabilities: ARMv6 NEON
[libx264 @ 0x3b56fe0] profile High, level 3.1
[libx264 @ 0x3b56fe0] 264 - core 146 - H.264/MPEG-4 AVC codec - Copyleft 
2003-2015 - 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
[alsa @ 0x3b412b0] Thread message queue blocking; consider raising the 
thread_queue_size option (current value: 8)
[alsa @ 0x3b412b0] ALSA buffer xrun.
Output #0, mp4, to 'Desktop/test.mp4':
   Metadata:
     encoder         : Lavf58.67.100
   Stream #0:0: Video: h264 (avc1 / 0x31637661), yuv420p(tv, 
progressive), 1280x720, q=2-31, 30 fps, 15360 tbn
     Metadata:
       encoder         : Lavc58.122.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), 48000 Hz, stereo, 
fltp, 128 kb/s
     Metadata:
       encoder         : Lavc58.122.100 aac
[video4linux2,v4l2 @ 0x3b3e390] Thread message queue blocking; consider 
raising the thread_queue_size option (current value: 8)
*frame=   51 fps=1.6 q=-1.0 Lsize=     549kB time=00:14:31.46 bitrate=   
5.2kbits/s dup=14 drop=0 speed=27.4x *
video:140kB audio:394kB subtitle:0kB other streams:0kB global 
headers:0kB muxing overhead: 2.829021%
[libx264 @ 0x3b56fe0] frame I:2     Avg QP:12.23  size: 45880
[libx264 @ 0x3b56fe0] frame P:14    Avg QP:19.18  size:  2835
[libx264 @ 0x3b56fe0] frame B:35    Avg QP:21.92  size:   335
[libx264 @ 0x3b56fe0] consecutive B-frames:  7.8%  0.0%  5.9% 86.3%
[libx264 @ 0x3b56fe0] mb I  I16..4: 66.3% 15.7% 18.0%
[libx264 @ 0x3b56fe0] mb P  I16..4:  0.6%  1.0%  0.2%  P16..4: 7.9%  
2.4%  1.2%  0.0%  0.0%    skip:86.7%
[libx264 @ 0x3b56fe0] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8: 4.6%  
0.2%  0.0%  direct: 0.1%  skip:95.0%  L0:52.4% L1:46.2% BI: 1.4%
[libx264 @ 0x3b56fe0] 8x8 transform intra:20.3% inter:78.3%
[libx264 @ 0x3b56fe0] coded y,uvDC,uvAC intra: 23.0% 30.3% 20.2% inter: 
1.1% 1.7% 0.4%
[libx264 @ 0x3b56fe0] i16 v,h,dc,p: 75% 18%  2%  5%
[libx264 @ 0x3b56fe0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 24% 27% 19% 4%  4%  
5%  5%  5%  6%
[libx264 @ 0x3b56fe0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 27% 34% 12% 3%  4%  
4%  6%  4%  5%
[libx264 @ 0x3b56fe0] i8c dc,h,v,p: 69% 19%  6%  5%
[libx264 @ 0x3b56fe0] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x3b56fe0] ref P L0: 71.6%  9.8% 14.0%  4.6%
[libx264 @ 0x3b56fe0] ref B L0: 92.3%  6.0%  1.7%
[libx264 @ 0x3b56fe0] ref B L1: 97.3%  2.7%
[libx264 @ 0x3b56fe0] kb/s:673.73
[aac @ 0x3b58f80] Qavg: 153.000


Lemme know if you need anything else!

Thanks,
Mike



On 2/13/2021 2:27 AM, Gisbert Haas wrote:
> 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 <mike at soultanian.com> 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 at 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 at 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 at 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 at 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 at 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
>>>> ffmpeg-user at ffmpeg.org
>>>> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>>>>
>>>> To unsubscribe, visit link above, or email
>>>> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".


More information about the ffmpeg-user mailing list