Pluto with H265 Encoder Box

Digital ATV - The latest generation, cutting edge ATV - Please discuss it all here.
Forum rules
This forum is run by the BATC (British Amateur Television Club), it is service made freely available to all interested parties, please do not abuse this privilege.

Thank you
M1SJE
Posts: 10
Joined: Fri Aug 02, 2019 6:37 am

Re: Pluto with H265 Encoder Box

Post by M1SJE » Sat May 16, 2020 8:17 pm

So after some digging, it looks like the issue is something to do with this block, in that it's not getting any data from $codec or $sound to make the block work.

Code: Select all

        if($_POST['codec']=="h265"){
                $codec=1;
        }else{
                $codec=0;
        }

        if($_POST['sound']=="On"){
                $sound=1;
        }else{
                $sound=0;
        }
If I echo out the XML, this is what's sent to the server.

Code: Select all

<?xml version: "1.0" encoding="utf-8"?>
        <request>
        <videoenc>
        <codec>0</codec>
        <resolution>384x216</resolution>
        <framerate>15</framerate>
        <audioen>0</audioen>
        <rc>1</rc>
        <keygop>30</keygop>
        <bitrate>118</bitrate>
        <quality>5</quality>
        <profile>0</profile>
        </videoenc>
        </request>
And if I echo out $codec or $sound, before the if/else code at the top, nothing is there, which explains why the if/else doesn't work. No data in, no data out.

Fun thing is, if i run this command

Code: Select all

php-cgi encoder_control.php 'enc_ip=10.1.1.237&codec=h265&res=576x324&fps=15&keyint=30&v_bitrate=280&sound=On&audio_input=hdmi&a
udio_channels=1&audio_bitrate=32000&enabled=true&pluto_ip=10.1.1.238&pluto_port=8282'
It works as expected.

So encoder_control.php definitely works, it's just not being fed with the data it needs to do its job.

Oh, if I manually run udpts.sh, it also sends the right command to the encoder.

Time for a break and figure out why everything else is being sent through but this isn't :)
Sarah M1SJE

g4eml
Posts: 690
Joined: Thu Apr 26, 2018 9:36 am

Re: Pluto with H265 Encoder Box

Post by g4eml » Sat May 16, 2020 9:03 pm

HI Sarah,

I have been having similar problems today when I tried to add an extra option to select the audio input. It appeared that the variable was not getting set, similar to what you have seen. Eventually the problem just seemed to go away on its own and started to work. That doesn't make much sense.

I also noticed very early on that the Mono/Stereo selection didn't work. It should select Mono for low bit rate modes (125Ks) but that never worked for me, even before I made any changes.

You will find that encoder_control.php is called from /root/udpts.sh. In this script the environmental variables are created from the settings file.

I suspect that something strange might be going on here and for some reason they are not always all being set correctly.
It may be some kind of timing issue, maybe the settings.txt file is still being written in the background and it needs a delay to allow that to finish.

The settings.txt file is created in save.php.

I have run out of time to continue this today. Maybe you might have some more luck.


73
Colin

M1SJE
Posts: 10
Joined: Fri Aug 02, 2019 6:37 am

Re: Pluto with H265 Encoder Box

Post by M1SJE » Sat May 16, 2020 9:22 pm

I've just been playing with udpts.sh, and as you suggested, there's a timing issue.

It seems like udpts.sh is being loaded before it's replaced with what's on the usb stick, so as expected, it wouldn't take account of the new variables.

If you run this command though...

Code: Select all

/etc/init.d/S90datv restart
Then changing the audio and codec settings works.

Thanks for the help :)
Sarah M1SJE

g0mjw
Posts: 2352
Joined: Sat Sep 20, 2014 9:15 am

Re: Pluto with H265 Encoder Box

Post by g0mjw » Sun May 17, 2020 8:03 am

Ah - and only sometimes in my case. I tried a faster memory card but noted that it might be better to do a restart but wasn't sure quite how to go about it. Perhaps at the end of the runme script.

g4eml
Posts: 690
Joined: Thu Apr 26, 2018 9:36 am

Re: Pluto with H265 Encoder Box

Post by g4eml » Sun May 17, 2020 10:44 am

It sounds like it might be dependent on the speed of the memory stick. A restart is a good way to overcome that. I will add it to the runme script.

Colin.

M0DTS
Posts: 656
Joined: Sun Feb 24, 2008 9:03 pm

Re: Pluto with H265 Encoder Box

Post by M0DTS » Sun May 17, 2020 12:24 pm

It maybe better to use the 'runme' script to wait for udpts script to start, stop it, replace it, then restart it.

I have not looked at the mono/stero problem, i wrote the encoder control script so will have a look later next week.
Probably a typo somewhere ;)

Rob

g4eml
Posts: 690
Joined: Thu Apr 26, 2018 9:36 am

Re: Pluto with H265 Encoder Box

Post by g4eml » Sun May 17, 2020 12:53 pm

Rob,

Mono/Stereo does work sometimes (and always when the value is forced to ignore the variable) so I don’t think the script itself is the problem. It seems more like an issue with variable passing between the scripts being unreliable.
The only reason I can think for that is if there is some sort of timing issue with writing and reading settings.txt. I will investigate later.

Colin.

g4eml
Posts: 690
Joined: Thu Apr 26, 2018 9:36 am

Re: Pluto with H265 Encoder Box

Post by g4eml » Sun May 17, 2020 5:41 pm

I found a problem with using /etc/init.d/S90datv restart
restart calls stop then start but stop doesn't actually do anything! So it just ends up creating duplicate tasks.

So I followed Rob's Idea and modified the runme0.sh script so that it does the following:-

Waits until the inbuilt udpts.sh is running
Kills it.
Copies the updated files.
Restarts udpts.sh

This seems to work. All the new options now work. (and so does the Mono/Stereo switching which never worked reliably for me previously!)

One thing you will need to do is to select 'Apply Settings' then 'Save to Flash' in the Pluto Controller Web page at least once. This updates the saved config to include the new settings.

I have uploaded the updated files to GitHub

73
Colin

M1SJE
Posts: 10
Joined: Fri Aug 02, 2019 6:37 am

Re: Pluto with H265 Encoder Box

Post by M1SJE » Mon May 18, 2020 10:28 am

Great, thanks for the fix, just tried it and it's working well :).
Sarah M1SJE

roland_F8CHK
Posts: 32
Joined: Fri Nov 17, 2017 3:05 pm

Re: Pluto with H265 Encoder Box

Post by roland_F8CHK » Fri May 22, 2020 9:12 am

Hi all,

Wondering if this could be of interest:
https://www.crowdsupply.com/luxonis/megaai

On board camera 4K, 60fps
H264 and H265 hardware encoding
usb3 interface

73,
Roland F8CHK

Post Reply

Return to “DATV - Digital ATV”