Tiny Core Base > Raspberry Pi

Rpi 3 Model B hardware acceleration for transposing video?

(1/2) > >>

Cheembus:
Hello,

I've been banging my head over this for a bit. I have an rpi 3 model B that I have Motion running on it (for those who dont know what Motion is, it's basically security webcam software) and using a USB webcam. my webcam is mounted sideways, so I have to transpose it 270 degrees so it looks right-side-up on my stream. The issue is, Motion's transposing mechanism is software-only, and as a result there's higher than I'd want cpu usage. I am lucky, however, Motion supports named pipes as input devices, so rather than open the /dev/video0 device directly and perform the software transposing on Motion itself, I could theoretically use a third party app to perform the transposing and pipe to a named FIFO. This leads me to my actual question: is there a way to perform encoding, decoding and transposing via hardware acceleration on tinycore? Ideally I would use FFMPEG to do all these but I haven't been able to find the right command that would use some kind of hardware acceleration for the transposing. if FFMPEG or gstreamer has flag to pass to it or a command, or if someone knows of a module that would unlock hardware acceleration for what I am trying to do here, that would be great for me to know.

Juanito:
Something analogous to this:
--- Code: ---ffplay -i /mnt/mmcblk0p2/media/video/jellyfish-3-mbps-hd-h264.mkv -vcodec h264_v4l2m2m
--- End code ---

..which would use /dev/video10?

I think gstreamer would use v4l2h264dec

aus9:
I think OP wants to encode? But if so you might like to share what format the resultant encoding should have?
try simple first

--- Code: ---ffmpeg -i filename.mkv outputname.mp4
--- End code ---
Use ffprobe to find out your input codec....which becomes what you need TCEs you need to load to decode
and then you need to load TCEs that will support your encoding codecs

Anyhow I am working on something that involves ffmpeg7 on another arch and generated the decoders and encoders by

--- Code: ---ffmpeg -decoders > /tmp/decoders.txt
ffmpeg -encoders > /tmp/encoders.txt
--- End code ---

If you trust me here are links to my dropbox site
https://www.dropbox.com/scl/fi/jlo0zsnlk7182pnmpz8gg/decoders.txt?rlkey=cagnoovcclib551fo3gzcw7y5&st=hdntt4wy&dl=0

https://www.dropbox.com/scl/fi/625uucn11lg7us637kyjl/encoders.txt?rlkey=fwo8s5u285s3ay3iz2zr8zg50&st=0l4jw6xi&dl=0

For a static mkv video you can run

--- Code: ---ffprobe name.mkv
--- End code ---
and I get get these results for a sample YMMV....TCE names are from TC64
mkv video h264        TCE=x264_164 
mkv audio vorbis         TCE=libvorbis

Juanito:
I've successfully tried video hardware decoding, but I have not tried video hardware encoding on RPi.

You would think someting like this might work:
--- Code: ---ffmpeg -c:v mpeg4_v4l2m2m -i input.m4v -c:v h264_v4l2m2m -c:a aac out.mp4
--- End code ---

For Rpi3
If I understand correctly, the hardware decoding is on /dev/video10:
--- Code: ---v4l2-ctl --list-formats-out -d 10
ioctl: VIDIOC_ENUM_FMT
        Type: Video Output Multiplanar

        [0]: 'MPG4' (MPEG-4 Part 2 ES, compressed)
        [1]: 'H264' (H.264, compressed)
        [2]: 'MJPG' (Motion-JPEG, compressed)
        [3]: 'H263' (H.263, compressed)
--- End code ---

and the encoder controls on /dev/video11:
--- Code: ---4l2-ctl --list-ctrls -d11

Codec Controls

                 video_b_frames 0x009909ca (int)    : min=0 max=0 step=1 default=0 value=0 flags=update
                 video_gop_size 0x009909cb (int)    : min=0 max=2147483647 step=1 default=60 value=60
             video_bitrate_mode 0x009909ce (menu)   : min=0 max=1 default=0 value=0 (Variable Bitrate) flags=update
                  video_bitrate 0x009909cf (int)    : min=25000 max=25000000 step=25000 default=10000000 value=10000000
           sequence_header_mode 0x009909d8 (menu)   : min=0 max=1 default=1 value=1 (Joined With 1st Frame)
         repeat_sequence_header 0x009909e2 (bool)   : default=0 value=0
                force_key_frame 0x009909e5 (button) : value=0 flags=write-only, execute-on-write
          h264_minimum_qp_value 0x00990a61 (int)    : min=0 max=51 step=1 default=20 value=20
          h264_maximum_qp_value 0x00990a62 (int)    : min=0 max=51 step=1 default=51 value=51
            h264_i_frame_period 0x00990a66 (int)    : min=0 max=2147483647 step=1 default=60 value=60
                     h264_level 0x00990a67 (menu)   : min=0 max=15 default=11 value=11 (4)
                   h264_profile 0x00990a6b (menu)   : min=0 max=4 default=4 value=4 (High)
--- End code ---

From ffmpeg:
--- Code: ---ffmpeg -encoders | grep mem2mem
..
 V..... h263_v4l2m2m         V4L2 mem2mem H.263 encoder wrapper (codec h263)
 V..... h264_v4l2m2m         V4L2 mem2mem H.264 encoder wrapper (codec h264)
 V..... hevc_v4l2m2m         V4L2 mem2mem HEVC encoder wrapper (codec hevc)
 V..... mpeg4_v4l2m2m        V4L2 mem2mem MPEG4 encoder wrapper (codec mpeg4)
 V..... vp8_v4l2m2m          V4L2 mem2mem VP8 encoder wrapper (codec vp8)
--- End code ---


--- Code: ---ffmpeg -decoders | grep mem2mem
...
 V..... h263_v4l2m2m         V4L2 mem2mem H.263 decoder wrapper (codec h263)
 V..... h264_v4l2m2m         V4L2 mem2mem H.264 decoder wrapper (codec h264)
 V..... hevc_v4l2m2m         V4L2 mem2mem HEVC decoder wrapper (codec hevc)
 V..... mpeg1_v4l2m2m        V4L2 mem2mem MPEG1 decoder wrapper (codec mpeg1video)
 V..... mpeg2_v4l2m2m        V4L2 mem2mem MPEG2 decoder wrapper (codec mpeg2video)
 V..... mpeg4_v4l2m2m        V4L2 mem2mem MPEG4 decoder wrapper (codec mpeg4)
 V..... vc1_v4l2m2m          V4L2 mem2mem VC1 decoder wrapper (codec vc1)
 V..... vp8_v4l2m2m          V4L2 mem2mem VP8 decoder wrapper (codec vp8)
 V..... vp9_v4l2m2m          V4L2 mem2mem VP9 decoder wrapper (codec vp9)
--- End code ---

Cheembus:
Hello all,

Finally have time to respond. I have the following video devices:

video0   video1   video13  video14  video15  video16  video20  video21  video22  video23

due to some research (research being chatgpt - sorry) it seems I am missing bcm2835_codec and/or bcm2835_v4l2 kernel modules. I do recall many years ago disabling one of those because of weird kernel panics I was having on a previous version of TC, so let me check my bootargs and see if I need to remove it's blacklisting

Edit: I do in fact have blacklist=bcm2835-codec blacklist=bcm2835_v4l2 blacklist=bcm2835-ispi in my cmdline.txt. removing those lines and rebooting.

Navigation

[0] Message Index

[#] Next page

Go to full version