Jump to content

4kp30 video on Orange Pi Lite and mainline hardware acceleration


genesys

Recommended Posts

21 hours ago, jernej said:

Note that ffmpeg patches for request API are important - without patched ffmpeg, all kernel patches have no meaning. Second important thing is that LibreELEC runs Kodi without X11 for ARM boards - this allows to use display more efficiently. On X11 it would be needed to render video through GPU which is less efficient. Note that I never actually tried that.

Am I understanding it correctly that it works as follows?

LibreElec patches the kernel to make use of the SoC's VPU. (Some of these patches make their way upstream eventually, but that's a slow process.) It also forks ffmpeg, which is patched to recognise these new kernel features & to make use of them. Kodi then refers to ffmpeg to access them.

What would be necessary for players other than Kodi—mpv or VLC for example—to benefit from this as well? And what is the role of libva, VAAPI, and these other things in this process?

Link to comment
Share on other sites

Basically yes. Note that kernel patches are only for improvements - fixing decoding issues. At least H264 API should be promoted to stable with kernel 5.10, maybe others too.

 

Any player which uses ffmpeg directly should be able to benefit from those patches. AFAIK mpv needs only one simple patch in order to use this chain. I have no idea about VLC internals so I can't say much about it. About VAAPI - request API (Cedrus implements it for decoding) is similar in terms of requirements and features to VAAPI so Bootlin created simple library to expose it. That way they could use any VAAPI capable player. However, some codec interfaces changed considerably from those times and Bootlin didn't invest any time to update this library, so it's not very useful ATM unless you know how to fix it. I know that some people has still interest in that library so I imagine it will be forked/updated once api stabilizes further.

 

Note that there is one hidden issue. As long as you play video in native size, all is well. If you want to scale it then you might get a lot of dropped frames. Issue here is how you do scaling. It's pretty intense process for CPU so you should avoid that at any cost. Unfortunately, VLC with VAAPI translation library did just that. Second option is to go with GPU. IIUC it was impossible to do with binary drivers due to missing import buffer functions, but with mesa it should work now (didn't try it myself). Note that mali400 may still be limiting factor for some cases. Another approach is to use dedicated HW cores. For example, deinterlace core on H3 can be used for scaling only (with few driver tweaks). Downside of this is that scaling process depends on SoC. This would be different even for Allwinner SoCs (not all SoCs have deinterlacer). Most efficient approach (used in LibreELEC) is to use DRM planes - you instruct display engine how to scale and crop it and where on screen to render it. However, I'm not sure if this can work on X11 at all. Wayland should be able to pull this off IIUC.

 

Disclaimer: I don't care about desktop on ARM boards so I didn't do many experiments in this regard and I don't plan to work on improving desktop experience. LE runs without any desktop on ARM boards. Note that I also don't plan to work on any player except ffmpeg/Kodi combo.

Link to comment
Share on other sites

I see; thanks for your detailed response.

VAAPI is of interest to me since IIRC it's what jellyfin interfaces with to provide transcoding to clients, but it's more of an abstract interest since I just watch everything on my desktop anyway.

In this context I'm pleased to hear that getting mpv to work may not be so difficult after all. When I have time, I'm going to try and look into into how mpv interfaces with ffmpeg.

Link to comment
Share on other sites

Here are the Armbian bionic images with installed RTSP streamer using H264 HW encoding on Allwinner H3 boards

Orange Pi One

Orange Pi Zero

Images are able to run on any board with Allwinner H3

 

Spoiler

Description:
The image is Armbian bionic 20.08 mainline kernel 5.7.15 with installed RTSP server sourced from the HW encoded H264 bitstream.

H264 HW encoder uses sunxi cedrus driver and takes video from the video device /dev/videoN.
Any USB camera with output format YUV 4:2:2 or NV12 can be used as the image source for the encoder.
The system uses UCI from the OpenWrt project (https://openwrt.org/docs/guide-user/base-system/uci) to manage settings of the RTSP streamer.

RTSP server is starting on boot as a service named supervisor (systemctl start/stop/restart supervisor)
To watch RTSP stream from the board use mpv or vlc:

mpv --profile=low-latency --no-cache --untimed rtsp://YUR_BOARD_IP/live.cam
or
vlc --sout-udp-caching=0 --clock-jitter=500 rtsp://YUR_BOARD_IP/live.cam

 

Installation:
1. Unpack the image
2. Instal the image to the SD card (linux: sudo dd if=armbian_bionic_rtsp_h264_opi_one.img of=/dev/sdX bs=1M)
3. Insert and power up

username: root
password: 123


Settings:
To display RTSP settings use uci show:

uci show system.rtsp

  system.rtsp=rtsp
  system.rtsp.proto='udp'
  system.rtsp.device='/dev/video0'
  system.rtsp.format='YUYV'
  system.rtsp.port='554'
  system.rtsp.resolution='640x480'
  system.rtsp.channel='live.cam'
  system.rtsp.framerate='25'
  system.rtsp.server='rtsp'
  system.rtsp.uclnt='0.0.0.0'
 
To change any settings use command uci set:
...
uci set system.rtsp.device=/dev/video1
uci set system.rtsp.format=UYVY
...

To save changes use command uci commit:
uci commit

Settings description:
  system.rtsp.proto - rtsp server network protocol (udp/tcp)
  system.rtsp.device - input video device for h264 encoder (/dev/videoN)
  system.rtsp.format - input image format (YUYV, UYVY, H264, NV12) from the /dev/videoN
  system.rtsp.port - RTSP server port
  system.rtsp.resolution - input image resolution
  system.rtsp.framerate - input stream framerate
  system.rtsp.server - must be rtsp
  system.rtsp.uclnt - not used

To apply config changes use restart service:
systemctl restart supervisor
 
Troubleshooting:
If there is no RTSP stream after the board is started:
* check the Ethernet cable connected
* check the USB camera connected
* check the USB camera valid name setting (/dev/video0,1,2...N)
* check the USB camera image format supported (YUYV, UYVY, NV12, H264)
* check your router RTSP port unblocked
* check valid command line arguments for playing remote RTSP stream

 

Link to comment
Share on other sites

On 9/4/2020 at 12:25 PM, ubobrov said:

Here are the Armbian bionic images with installed RTSP streamer using H264 HW encoding on Allwinner H3 boards

Orange Pi One

Orange Pi Zero

Images are able to run on any board with Allwinner H3

 

  Reveal hidden contents

Description:
The image is Armbian bionic 20.08 mainline kernel 5.7.15 with installed RTSP server sourced from the HW encoded H264 bitstream.

H264 HW encoder uses sunxi cedrus driver and takes video from the video device /dev/videoN.
Any USB camera with output format YUV 4:2:2 or NV12 can be used as the image source for the encoder.
The system uses UCI from the OpenWrt project (https://openwrt.org/docs/guide-user/base-system/uci) to manage settings of the RTSP streamer.

RTSP server is starting on boot as a service named supervisor (systemctl start/stop/restart supervisor)
To watch RTSP stream from the board use mpv or vlc:

mpv --profile=low-latency --no-cache --untimed rtsp://YUR_BOARD_IP/live.cam
or
vlc --sout-udp-caching=0 --clock-jitter=500 rtsp://YUR_BOARD_IP/live.cam

 

Installation:
1. Unpack the image
2. Instal the image to the SD card (linux: sudo dd if=armbian_bionic_rtsp_h264_opi_one.img of=/dev/sdX bs=1M)
3. Insert and power up

username: root
password: 123


Settings:
To display RTSP settings use uci show:

uci show system.rtsp

  system.rtsp=rtsp
  system.rtsp.proto='udp'
  system.rtsp.device='/dev/video0'
  system.rtsp.format='YUYV'
  system.rtsp.port='554'
  system.rtsp.resolution='640x480'
  system.rtsp.channel='live.cam'
  system.rtsp.framerate='25'
  system.rtsp.server='rtsp'
  system.rtsp.uclnt='0.0.0.0'
 
To change any settings use command uci set:
...
uci set system.rtsp.device=/dev/video1
uci set system.rtsp.format=UYVY
...

To save changes use command uci commit:
uci commit

Settings description:
  system.rtsp.proto - rtsp server network protocol (udp/tcp)
  system.rtsp.device - input video device for h264 encoder (/dev/videoN)
  system.rtsp.format - input image format (YUYV, UYVY, H264, NV12) from the /dev/videoN
  system.rtsp.port - RTSP server port
  system.rtsp.resolution - input image resolution
  system.rtsp.framerate - input stream framerate
  system.rtsp.server - must be rtsp
  system.rtsp.uclnt - not used

To apply config changes use restart service:
systemctl restart supervisor
 
Troubleshooting:
If there is no RTSP stream after the board is started:
* check the Ethernet cable connected
* check the USB camera connected
* check the USB camera valid name setting (/dev/video0,1,2...N)
* check the USB camera image format supported (YUYV, UYVY, NV12, H264)
* check your router RTSP port unblocked
* check valid command line arguments for playing remote RTSP stream

 

None of these images work on Orange Pi Zero +2 H3 :(
Can you please upload version for Zero +2?

Link to comment
Share on other sites

9 hours ago, ubobrov said:

None of these images work on H5. 

Unfortunetely, encoder doesn't work on H5

 

17 hours ago, martinayotte said:

OPiZeroPlus2 is using H5 SoC, not H3 ...

Guys, Orange Pi Zero +2 H3 is based on H3 chip! There are 2 different types of OPiZeroPlus2.
I need image for H3 version.

Watch this:
https://www.armbian.com/orange-pi-zero-plus-2-h3/
https://www.orangepi.su/content.php?p=122&c=Orange Pi Zero Plus 2 H3

Link to comment
Share on other sites

On 9/19/2019 at 6:29 AM, jernej said:

It's tricky and needed kernel header files are not exposed in UAPI (userspace API) yet because they are still evolving and changing.

 

You can try following:

1. Apply Linux patches 1 (you can filter out only media related patches), 5, 7-11 on kernel 5.3: https://github.com/jernejsk/LibreELEC.tv/tree/cedrus_update/projects/Allwinner/patches/linux

2. Apply all FFmpeg patches on FFmpeg 4.0.4 (it is easy to port those patches on newer version, to avoid rebuilding mpv): https://github.com/jernejsk/LibreELEC.tv/tree/cedrus_update/packages/multimedia/ffmpeg/patches/v4l2-request-api

3. Compile FFmpeg with at least following options


--enable-v4l2-request --enable-libudev --enable-libdrm

4. Recompile mpv if needed - depends on FFmpeg version used. If it matches to what was was used to compile mpv with, then there is no need.

5. Add your user to appropriate group ("video" I think) so you can use VPU without root privileges.

 

Now you should have working mpv with HW accelerated decoding. As I don't use any desktop on SBCs, I run mpv with following options:


mpv --hwdec=auto --vo=drm video.mkv

This gives you most speed - HW decoded and directly rendered by DRM driver, so CPU is not involved. Only downside is that it is fullscreen only. Not sure how big performance hit (CPU usage) you would get with X11.

Hi,

I've got an OrangePi Zero2 with the Allwinner H616 chip on.  Is this patch likely to work with that, and is there a base Armbian image I can use to start from?  Currently I have an OrangePi image and video decoding is not working fast enough.  I need to be able to decode h.264 1080p60 reliably without using all the CPU power.

As an aside, if I try and follow those links given above to github.com it gives me a 404 error.  Are they git clone links, rather than webpage links?

 

thanks,

skb13

Link to comment
Share on other sites

1 hour ago, skb13 said:

As an aside, if I try and follow those links given above to github.com it gives me a 404 error. 

I regularly delete my branches because all work is eventually merged to  https://github.com/LibreELEC/LibreELEC.tv (you quoted quiet old post).

 

But as @Werner said, H616 is not exactly the same as H6 regarding display stuff so it needs quiet a lot of work. Cedrus will be probably easy, but that comes after display stack.

Link to comment
Share on other sites

Hi Ubobrov

 

You seem to be the expert on using the Cedrus decoder under Armbian so I've got a few questions that I'm hoping you would be kind enough to answer:

 

Have you tried 4K@30fps h264 playback using cedrus/v4l2-request with mpv?

 

Have you tried the most recent 5.10 Libreelec AW kernel patches? I'm hoping Balbes can include these in the Armbian AW kernel as standard.

 

Have you also got an Allwinner H6 board? Your guide should also work for H6 devices. I've got a T95 Max.

 

I noticed in your guide to building ffmpeg you disable vaapi and vdpau. Why? Was that just to save build time or do you have another reason? It may no longer be required to rebuild ffmpeg, maybe v4l2-request is enabled in the regular deb now?

 

It looks like libvdpau-sunxi isn't required and it hasn't been updated in years so I presume its dead.

Link to comment
Share on other sites

I can answer a couple of my questions after having had a quick look at this.

 

v4l2-request hasn't been merged into the latest ffmpeg stable release, the Debian sid package or the git repo yet so it is still required to patch and build ffmpeg to get v4l2-request but unfortunately I've not been unable to get the ffmpeg v4l2-request patch to cleanly apply to ffmpeg git or 4.0.6, which is the nearest release I can find online to the 4.0.4 that Ubobrov says he got to work.

 

Does anyone know where I can get a ffmpeg 4.0.4 source tarball? Otherwise, checking out a git commit from December 2018 might get the patch to fully apply?

 

EDIT

 

It's past my bedtime as I can't even do simple searches

 

https://ffmpeg.org/releases/ffmpeg-4.0.4.tar.gz

EDIT 2

 

Nope! The patch doesn't cleanly apply to 4.0.4 either :/

Link to comment
Share on other sites

Third time unlucky, I finally tried applying it to the 'correct' version:

 

~/src/FFmpeg-4.0.4-Leia-18.4$ patch -p 1 < ffmpeg-001-v4l2-request.patch
patching file libavutil/buffer.c
Hunk #1 succeeded at 272 (offset -1 lines).
patching file libavutil/buffer.h
Hunk #1 succeeded at 266 (offset -1 lines).
patching file configure
Hunk #1 succeeded at 264 with fuzz 2 (offset -10 lines).
Hunk #2 succeeded at 325 (offset -18 lines).
Hunk #3 succeeded at 1734 (offset -75 lines).
Hunk #4 FAILED at 1864.
Hunk #5 FAILED at 2906.
Hunk #6 succeeded at 6066 with fuzz 1 (offset -313 lines).
Hunk #7 FAILED at 6479.
Hunk #8 FAILED at 6560.
4 out of 8 hunks FAILED -- saving rejects to file configure.rej
patching file libavcodec/Makefile
Hunk #1 succeeded at 143 (offset -10 lines).
can't find file to patch at input line 157
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/libavcodec/hwconfig.h b/libavcodec/hwconfig.h
|index f421dc909f44..ee78d8ab8e89 100644
|--- a/libavcodec/hwconfig.h
|+++ b/libavcodec/hwconfig.h
--------------------------
File to patch:

 

Link to comment
Share on other sites

Which is your kernel version?

 

This is 4.3.1 branch which should work with kernel 5.13: https://github.com/jernejsk/FFmpeg/commits/v4l2-request-hwaccel-4.3.1-new

 

gstreamer also made a ton of progress in last few days and it currently passes even more H264 conformance tests than ffmpeg. However, you need to build latest source from git.

Link to comment
Share on other sites

Hi jernej

 

mpv is the only fully-featured video player for me. I'm not interested in any other video player but its nice to know gstreamer is progressing.

 

I'm running balbes latest aw sid image with a 5.10.27 kernel which he says includes the libreelec cedrus patches already.

 

I've tried to build your ffmpeg repo but:


 

CC      libavcodec/v4l2_request_h264.o                                                                                                            
In file included from libavcodec/v4l2_request_h264.c:22:                                                                                          
libavcodec/h264-ctrls.h:64:8: error: redefinition of ‘struct v4l2_ctrl_h264_sps’                                                                  
   64 | struct v4l2_ctrl_h264_sps {                                                                                                               
      |        ^~~~~~~~~~~~~~~~~~                                                                                                                 
In file included from /usr/include/linux/videodev2.h:65,                                                                                          
                 from libavcodec/v4l2_request.h:22,                                                                                               
                 from libavcodec/v4l2_request_h264.c:21:                                                                                          
/usr/include/linux/v4l2-controls.h:1305:8: note: originally defined here                                                                          
 1305 | struct v4l2_ctrl_h264_sps {                                                                                                               
      |        ^~~~~~~~~~~~~~~~~~                                                                                                                 
In file included from libavcodec/v4l2_request_h264.c:22:                                                                                          
libavcodec/h264-ctrls.h:94:8: error: redefinition of ‘struct v4l2_ctrl_h264_pps’                                                                  
   94 | struct v4l2_ctrl_h264_pps {                                                                                                               
      |        ^~~~~~~~~~~~~~~~~~                                                                                                                 
In file included from /usr/include/linux/videodev2.h:65,                                                                                          
                 from libavcodec/v4l2_request.h:22,                                                                                               
                 from libavcodec/v4l2_request_h264.c:21:                                                                                          
/usr/include/linux/v4l2-controls.h:1361:8: note: originally defined here                                                                          
 1361 | struct v4l2_ctrl_h264_pps {                                                                                                               
      |        ^~~~~~~~~~~~~~~~~~                                                                                                                 
In file included from libavcodec/v4l2_request_h264.c:22:                                                                                          
libavcodec/h264-ctrls.h:108:8: error: redefinition of ‘struct v4l2_ctrl_h264_scaling_matrix’                                                      
  108 | struct v4l2_ctrl_h264_scaling_matrix {                                                                                                    
      |        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/linux/videodev2.h:65,
                 from libavcodec/v4l2_request.h:22,
                 from libavcodec/v4l2_request_h264.c:21:
/usr/include/linux/v4l2-controls.h:1393:8: note: originally defined here

1393 | struct v4l2_ctrl_h264_scaling_matrix {
      |        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from libavcodec/v4l2_request_h264.c:22:
libavcodec/h264-ctrls.h:113:8: error: redefinition of ‘struct v4l2_h264_weight_factors’
  113 | struct v4l2_h264_weight_factors {
      |        ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/linux/videodev2.h:65,
                 from libavcodec/v4l2_request.h:22,
                 from libavcodec/v4l2_request_h264.c:21:
/usr/include/linux/v4l2-controls.h:1398:8: note: originally defined here
 1398 | struct v4l2_h264_weight_factors {
      |        ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from libavcodec/v4l2_request_h264.c:22:
libavcodec/h264-ctrls.h:134: warning: "V4L2_H264_SLICE_FLAG_DIRECT_SPATIAL_MV_PRED" redefined
  134 | #define V4L2_H264_SLICE_FLAG_DIRECT_SPATIAL_MV_PRED 0x04
      |
In file included from /usr/include/linux/videodev2.h:65,
                 from libavcodec/v4l2_request.h:22,
                 from libavcodec/v4l2_request_h264.c:21:
/usr/include/linux/v4l2-controls.h:1435: note: this is the location of the previous definition
 1435 | #define V4L2_H264_SLICE_FLAG_DIRECT_SPATIAL_MV_PRED 0x01
      |
In file included from libavcodec/v4l2_request_h264.c:22:
libavcodec/h264-ctrls.h:135: warning: "V4L2_H264_SLICE_FLAG_SP_FOR_SWITCH" redefined
  135 | #define V4L2_H264_SLICE_FLAG_SP_FOR_SWITCH  0x08
      |
In file included from /usr/include/linux/videodev2.h:65,
                 from libavcodec/v4l2_request.h:22,
                 from libavcodec/v4l2_request_h264.c:21:
/usr/include/linux/v4l2-controls.h:1436: note: this is the location of the previous definition
 1436 | #define V4L2_H264_SLICE_FLAG_SP_FOR_SWITCH  0x02
      |
In file included from libavcodec/v4l2_request_h264.c:22:

libavcodec/h264-ctrls.h:137:8: error: redefinition of ‘struct v4l2_ctrl_h264_slice_params’
  137 | struct v4l2_ctrl_h264_slice_params {
      |        ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/linux/videodev2.h:65,
                 from libavcodec/v4l2_request.h:22,
                 from libavcodec/v4l2_request_h264.c:21:
/usr/include/linux/v4l2-controls.h:1496:8: note: originally defined here
 1496 | struct v4l2_ctrl_h264_slice_params {
      |        ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from libavcodec/v4l2_request_h264.c:22:
libavcodec/h264-ctrls.h:193:8: error: redefinition of ‘struct v4l2_h264_dpb_entry’
  193 | struct v4l2_h264_dpb_entry {
      |        ^~~~~~~~~~~~~~~~~~~
In file included from /usr/include/linux/videodev2.h:65,
                 from libavcodec/v4l2_request.h:22,
                 from libavcodec/v4l2_request_h264.c:21:
/usr/include/linux/v4l2-controls.h:1541:8: note: originally defined here
 1541 | struct v4l2_h264_dpb_entry {
      |        ^~~~~~~~~~~~~~~~~~~
In file included from libavcodec/v4l2_request_h264.c:22:
libavcodec/h264-ctrls.h:205:8: error: redefinition of ‘struct v4l2_ctrl_h264_decode_params’
  205 | struct v4l2_ctrl_h264_decode_params {
      |        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/linux/videodev2.h:65,
                 from libavcodec/v4l2_request.h:22,
                 from libavcodec/v4l2_request_h264.c:21:
/usr/include/linux/v4l2-controls.h:1578:8: note: originally defined here
 1578 | struct v4l2_ctrl_h264_decode_params {
      |        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
make: *** [ffbuild/common.mak:60: libavcodec/v4l2_request_h264.o] Error 1

 

Link to comment
Share on other sites

I'm pretty sure you didn't try to compile "v4l2-request-hwaccel-4.3.1-new" branch or you modified it. Obviously, you have old branch with its own h264 control definitions and new kernel, which have them in uapi. Make sure there is no h264-ctrls.h file in libavcodec. If it is, you have wrong branch or you tried to mix some branches and/or patches together.

 

FYI, I don't care about mpv, so you'll have to make it work yourself. I can only help you build ffmpeg.

Link to comment
Share on other sites

Yes, I was using the wrong branch but this works to build it:

 

git clone https://github.com/jernejsk/FFmpeg.git
cd FFmpeg/
git checkout v4l2-request-hwaccel-4.3.1-new
./configure --enable-v4l2-request --enable-libudev --enable-libdrm


 

The example playback command given doesn't work tho:

 

ffmpeg -re -hwaccel drm -i Big_Buck_Bunny_720_10s_2MB.mp4 out.avi

 

That command gives the errors:


 

h264 @ 0x...: v4l2_request_probe_video_device: set controls failed, Invalid argument (22)

h264 @ 0x...:  Failed setup for format drm_prime: hwaccel initialization returned error

 

lsmod says sunxi_cedrus is loaded. I get these errors running ffmpeg as root or a normal user.

 

I'd have to build and use ffplay (or mpv) for video playback right? I'm sure ffmpeg used to include ffplay but it doesn't seem to any more. I want to see it working under ffmpeg/ffplay first before I attempt mpv.

 

 

Link to comment
Share on other sites

I'm rebuilding ffmpeg from your repo with but with the --enable-ffplay configure option this time.

 

However, after running configure I noticed these lines in the configure output:

 

External libraries providing hardware acceleration:
v4l2_m2m                v4l2_request            xvmc

 

 

External libraries? Is there another library I need to install before building ffmpeg to get v4l2_request to work?

Link to comment
Share on other sites

5 hours ago, Dan MacDonald said:

External libraries? Is there another library I need to install before building ffmpeg to get v4l2_request to work?

Nothing besides libdrm and libudev (should be part of systemd).

 

20 hours ago, Dan MacDonald said:

That command gives the errors:


 

h264 @ 0x...: v4l2_request_probe_video_device: set controls failed, Invalid argument (22)

Strange. Which kernel are you using? That branch was tested against 5.13 but it should work also against 5.12.

 

What does "-re" parameter? Please add "-loglevel debug" and post debug log.

 

Link to comment
Share on other sites

First we need to work out the command I should be using to play a video. I've built ffplay but it seems ffplay doesn't natively support hwaccel. I'm not sure if Ubobrov got a video to play with ffmpeg as I don't think this a feature ffmpeg supports without using ffplay, maybe he only got decoding but not playback to work? I have got ffplay to output the first frame of my video to my display on my T95 max but no smooth playback yet. It seems you have to do the decoding in ffmpeg and pipe it to ffplay using a command like:

 

ffmpeg -hwaccel drm -i test.mp4 -vcodec copy -acodec copy -f matroska - | ffplay -i -

 

Ubobrov used -hwaccel drm but is that correct? If I run `ffmpeg -decoders | grep h264` I don't see a v4l2-request or a drm decoder. Should I?

 

If I try using matroska or rawvideo as the file format, I get the error:

 

Error writing trailer of pipe: Broken pipe

 

If I use the same command but I use -f mp4 instead I get the error:

 

mp4 @ 0xblah: muxer does not support non seekable output

 

Here is the mediainfo for my test file:


 

$ mediainfo VID_20210512_180639.mp4
General
Complete name                            : VID_20210512_180639.mp4
Format                                   : MPEG-4
Format profile                           : Base Media / Version 2
Codec ID                                 : mp42 (isom/mp42)
File size                                : 105 MiB
Duration                                 : 20 s 33 ms
Overall bit rate                         : 44.0 Mb/s
Encoded date                             : UTC 2021-05-12 17:07:00
Tagged date                              : UTC 2021-05-12 17:07:00
com.android.version                      : 10

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L4.1
Format settings                          : CABAC / 1 Ref Frames
Format settings, CABAC                   : Yes
Format settings, Reference frames        : 1 frame
Format settings, GOP                     : M=1, N=30
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 20 s 33 ms
Bit rate                                 : 43.4 Mb/s
Width                                    : 3 840 pixels
Height                                   : 2 160 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Variable
Frame rate                               : 30.000 FPS
Minimum frame rate                       : 29.910 FPS
Maximum frame rate                       : 30.090 FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.175
Stream size                              : 104 MiB (99%)
Title                                    : VideoHandle
Language                                 : English
Encoded date                             : UTC 2021-05-12 17:07:00
Tagged date                              : UTC 2021-05-12 17:07:00
Color range                              : Limited
Color primaries                          : BT.601 PAL
mdhd_Duration                            : 20033
Codec configuration box                  : avcC

Audio
ID                                       : 2
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : mp4a-40-2
Duration                                 : 20 s 23 ms
Duration_FirstFrame                      : 12 ms
Bit rate mode                            : Constant
Bit rate                                 : 192 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 469 KiB (0%)
Title                                    : SoundHandle
Language                                 : English
Encoded date                             : UTC 2021-05-12 17:07:00
Tagged date                              : UTC 2021-05-12 17:07:00

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines