I've been reading up on a lot of questions pertaining to ffmpeg and streaming a live feed from a webcam, and have gotten pretty close but I am just missing something small. I have a Pocketbeagle (pocket-size linux computer) running Debian, with a webcam attached via USB. The pocketbeagle is connected to my Windows computer via ethernet over USB. The pocketbeagle has the IP 192.168.7.2, and my computer 192.168.7.1. I am attempting to stream via UDP to VLC, but I cannot see the video feed on VLC no matter what I try
The command I am running is this:
ffmpeg -f v4l2 -input_format mjpeg -i /dev/video0 -framerate 10 -video_size 1280x720 -f mpegts udp:192.168.7.1:15151
This results in this output, which appears to actually be streaming something as the Lsize and time increase while it runs until I kill it:
ffmpeg version 4.1.6-1~deb10u1 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 8 (Debian 8.3.0-6)
configuration: --prefix=/usr --extra-version='1~deb10u1' --toolchain=hardened --libdir=/usr/lib/arm-
linux-gnueabihf --incdir=/usr/include/arm-linux-gnueabihf --arch=arm --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. 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
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 3.100 / 5. 3.100
libswresample 3. 3.100 / 3. 3.100
libpostproc 55. 3.100 / 55. 3.100
Input #0, video4linux2,v4l2, from '/dev/video0':
Duration: N/A, start: 2998.098197, bitrate: N/A
Stream #0:0: Video: mjpeg, yuvj422p(pc, bt470bg/unknown/unknown), 1280x720, 30 fps, 30 tbr,
1000k tbn, 1000k tbc
Stream mapping:
Stream #0:0 -> #0:0 (mjpeg (native) -> mpeg2video (native))
Press [q] to stop, [?] for help
[swscaler @ 0x1bb2d40] deprecated pixel format used, make sure you did set range correctly
Output #0, mpegts, to 'udp:192.168.7.1:15151':
Metadata:
encoder : Lavf58.20.100
Stream #0:0: Video: mpeg2video (4:2:2), yuv422p, 1280x720, q=2-31, 200 kb/s, 30 fps, 90k tbn, 30
tbc
Metadata:
encoder : Lavc58.35.100 mpeg2video
Side data:
cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
frame= 17 fps=2.8 q=31.0 Lsize= 654kB time=00:00:02.10 bitrate=2552.5kbits/s speed=0.343x x
video:605kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 8.214545%
Exiting normally, received signal 2.
On top of that, VLC recognizes a stream of some sort has started, and very slowly increments the time (like 1 second every 30s-1m). However, I do not see any video coming through.
Any help in getting this running would be much appreciated!
After much experimenting, I got a livestream working with ffmpeg, however the processor is not good enough to handle it and the video feed comes out at .25x speed even at 144p. If anyone is interested, here is the command I used:
ffmpeg -f v4l2 -input_format mjpeg -i /dev/video0 -r 10 -b:v 2000k -s 256x144 -c:v libx264 -f mpegts -flush_packets 0 udp://192.168.7.1:11795?pkt_size=1024
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With