HdmiPi-Streaming icon indicating copy to clipboard operation
HdmiPi-Streaming copied to clipboard

The command failed for me due to h264_omx

Open msoultan opened this issue 4 years ago • 3 comments

I'm trying to run your command and when I do I get the following error:

pi@raspberrypi:~/software/ffmpeg $ v4l2-ctl --set-fmt-video=width=1280,height=720 && ffmpeg -f v4l2 -thread_queue_size 384 -input_format mjpeg -framerate 30 -i /dev/video0 -f alsa -thread_queue_size 4096 -i plughw:2,0 -acodec pcm_s16le -ac 1 -ar 96000 -copytb 1 -use_wallclock_as_timestamps 1  -c:a aac  -b:a 128k -ar 44100 -b:v 4M -c:v h264_omx -f flv rtmp://sfo.contribute.live-video.net/app/[twitch key]
ffmpeg version N-100999-gbd52267 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 --disable-libaom --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libsvtav1 --enable-libdav1d --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree
  libavutil      56. 64.100 / 56. 64.100
  libavcodec     58.121.100 / 58.121.100
  libavformat    58. 67.100 / 58. 67.100
  libavdevice    58. 11.103 / 58. 11.103
  libavfilter     7.103.100 /  7.103.100
  libswscale      5.  8.100 /  5.  8.100
  libswresample   3.  8.100 /  3.  8.100
  libpostproc    55.  8.100 / 55.  8.100
[video4linux2,v4l2 @ 0x4ef5c70] Dequeued v4l2 buffer contains corrupted data (0 bytes).
    Last message repeated 31 times
Input #0, video4linux2,v4l2, from '/dev/video0':
  Duration: N/A, start: 0.000000, bitrate: N/A
  Stream #0:0: Video: mjpeg (Baseline), yuvj422p(pc, bt470bg/unknown/unknown), 1280x720, 30 fps, 30 tbr, 1000k tbn, 1000k tbc
Guessed Channel Layout for Input Stream #1.0 : stereo
Input #1, alsa, from 'plughw:2,0':
  Duration: N/A, start: 1613101324.004806, bitrate: 1536 kb/s
  Stream #1:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
Unknown encoder 'h264_omx'

So then I did a bunch of searching and it sounds like h264_omx is 1) a pain to set up and 2) outdated in favor of h264_v4l2m2m:

https://www.willusher.io/general/2020/11/15/hw-accel-encoding-rpi4

I was curious if you either had a guide to getting h264_omx set up, or any thoughts on using h264_v4l2m2m instead.

Thanks! Mike

msoultan avatar Feb 12 '21 03:02 msoultan

Hey, sorry for the slow response (internet/home computer issues), I looked into v4l2m2m but it had its own issues around the colour filters. OMX is unmaintained but it should still work. Where did you get FFmpeg from? Did you download it from the Pi's repositories or build it yourself?

PrawnMan avatar Mar 03 '21 16:03 PrawnMan

as far as I could find out h264_omx will only work in a 32 bit environment on a raspi 4 with 64 bit OS you need to change to v4l2m2m

hessenfarmer avatar Mar 18 '21 12:03 hessenfarmer

Cheers, I'll do some more testing on a 64bit OS and update my guide!

PrawnMan avatar Apr 03 '21 10:04 PrawnMan