shellixyz / hd_fpv_video_tool

A software tool to manipulate video files and OSD files recoded with the DJI and Walksnail Avatar FPV systems
GNU General Public License v2.0
17 stars 4 forks source link

MacOS BF AvatarHD various issues #4

Closed simoccc closed 1 year ago

simoccc commented 1 year ago

Hi,

first of al thanks for the great work !

I'm a user with:

Avatar system firmware 31 Betaflight 4.4 MacOS Monterey ( 12.6.x )

using WTF font_hd.bin

I'm having difficulties managing hiding informations ( expecialilty gps ) but that could be an avatar or font limitation I guess ?

the installation is Ok but I have this issues using the tool:

playwithosd not working because it searches for a Videofilename_osd.webm ( I have installed mpv and it works as a standalone cli program )

I want to move the OSD or hide regions but I cannot get any results from the commands :

--min-osd-margins --osd-hide-regions

I tried this values :

--osd-hide-regions 1,22:100x100 --min-osd-margins 100:100

and other combinations but I get no results and no apparent errors.

Another last cosmetic problem maybe it's simple to correct : return immediately and not at the end of the encoding the error if --osd-hide-items is not working , here is an example of my error:

hd_fpv_video_tool transcode-video --osd --osd-hide-items gpslat,gpslon ./AvatarG0076.mp4 INFO > looking for OSD file associated to video file: ./AvatarG0076.mp4 INFO > found: ./AvatarG0076.osd INFO > transcoding video: ./AvatarG0076.mp4 -> ./AvatarG0076_with_osd.mp4 INFO > calculated best approach: tile kind: HD - scaling: yes - overlay resolution: 1166x680 INFO > detected HD kind of tiles in /Users/montagna/.local/share/hd_fpv_video_tool/fonts/font_hd.bin INFO > resizing 256 tiles from 24x36 to 22x34 ERROR > unknown OSD item for Unknown font variant: gpslat

shellixyz commented 1 year ago

Hello,

  1. for the issue with play-video-with-osd you can specify the name of the video with the OSD after the DVR file name:

hd_fpv_video_tool play-video-with-osd dvr_file.mp4 osd_file.webm

Don't forget that you need to generate the "OSD video" first with the generate-overlay-video command, you cannot play a video with OSD from the .osd file as written in the README.

hd_fpv_video_tool generate-overlay-video file.osd dvr.mp4

This command will generate a dvr_osd.webm file you can then use with the play-video-with-osd command.

  1. hiding OSD parts:

I have tested --osd-hide-regions it is working as expected. Remember that the region x/y origin starts at 0 and that the coordinates represent OSD symbol coordinates, not video pixels. The easiest way to know what the right value is is to check your OSD configuration or to generate an OSD image frame on which you can overlay the OSD grid

--osd-hide-items doesn't work for you because I haven't specified inside the program what it needs to hide items for betaflight. I might add them when I have some free time. For now --osd-hide-items is only working with INAV and Ardupilot.

  1. "return immediately and not at the end of the encoding the error if --osd-hide-items is not working"

Not sure what you mean. I could make the program error out if the specified coordinates are not valid. Is that what you meant ?

simoccc commented 1 year ago

Thanks for the answer.

  1. Ok got it !
  2. Ok for the hide-items that it's not working for Walksnail. About --osd-hide-regions, I think in this way it's too complicated to use for an average user. Can you elaborate a way to simplify the process? I don't know maybe create a command that tells me the maximum values of the X,Y for my OSD ?

I don't know how to check OSD configuration ( it's a binary file ) and I cannot understand how to "generate an OSD image frame on which you can overlay the OSD grid" , how do I get the Grid? . Ok that it's not video pixel coordinates, there should be kind of maximum X,Y values available that you can get me available in some way?

Maybe the tiles values that transcode-video command returns at the beginning of the process are the max X,Y values or am I wrong ?

In the end I managed to find the region to hide, but it keeps me at least 10/15 video generations.

  1. Yes that is what I mean, just to avoid useless processing of the video.

Thanks for your work !

shellixyz commented 1 year ago

You are right osd-hide-regions is a bit complicated to use. I heard your feedback and will try to come up with something to make it easier in the next version. Unfortunately I am going to be very busy with work for a little while so I don't know when I am going to be able to do it.

For now there are 2 methods you can use:

You could start with 0,0:10x10 for example and see what it hides and then adjust accordingly until it is hiding what you'd like to hide. You can test with just a few seconds of video to make it quicker for example by passing --end 0:10 to transcode only the first 10 seconds of the video.

Another option is to generate a few frames of the OSD with the generate-overlay-frames --end 0:1 command which would generate 60 images, one for each of the first 60 frames of the video (1 second of 60fps video), containing only the OSD.

You can then:

You will see something like this image

Then you just have to get the coordinates and size of what you want to hide. For example in the previous example to hide the altitude you would use 46,6:4x1 which means start hiding at the the 47th tile from the left, 7th tile from the top and a region which is 4 tiles wide and 1 tile high.