How to adjust bitrate of allwinner's encoder dynamically

1,362 views
Skip to first unread message

lyc....@gmail.com

unread,
Apr 27, 2015, 2:45:12 AM4/27/15
to linux...@googlegroups.com
hi,all,

How to adjust bitrate  of allwinner's encoder dynamically,I tried to change, but did not seem to effect.

BR,

jons...@gmail.com

unread,
Apr 27, 2015, 9:22:02 AM4/27/15
to achun liu, linux-sunxi
I could not get it to work for lower bitrates. After about 1.5Mb/s it
stopped doing anything. I needed 500Kb/s for my application and was
unable to get that.


>
> BR,
>
> --
> You received this message because you are subscribed to the Google Groups
> "linux-sunxi" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to linux-sunxi...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
Jon Smirl
jons...@gmail.com

kevin....@gmail.com

unread,
Apr 28, 2015, 10:37:37 PM4/28/15
to jonsmirl, achun liu, linux...@googlegroups.com
Hi, 

The encoder allows you to set the MaxQp(0~51), MinQp(0~51), and MaxBitrate

parameters. MaxQp and MinQp are used to controlpicture quality and MaxBitrate

is used to clamp the maximum encoding bit rate within the bitrate statistical

time;

The default configuration is MinQp = 10;  MaxQp = 40. If you could not get

it to work for lower bitrates , please try to change MaxQp to a bigger value,

then maybe reduce the qulity of the picture.



lyc....@gmail.com

unread,
Apr 29, 2015, 3:47:25 AM4/29/15
to linux...@googlegroups.com, jons...@gmail.com, lyc....@gmail.com
HI,

I realize encoder reference linux-codec-release-V1.2(https://github.com/juanfont/cedar-encoder),The encoder operation interface VENC_CMD_SET_FROFILE_LEVEL, VENC_CMD_SET_BITRATE,VENC_CMD_SET_QP_RANGE not be used, after setting the encoder does not support this command is given, According to the documentation 'AWCodec Development Reference Manual V1.2' know encoder modes are CBR (constant bit stream) / VBR (dynamic streams) mode, but we can not use VBR mode,I try to change the bitrate when encoder running through an interface VENC_CMD_BASE_CONFIG, there is no effect, A20 platform is not provide VBR stream dynamic regulation mode ,and the default is now the encoder base profile mode, I want to set for the High profile can not.

在 2015年4月29日星期三 UTC+8上午10:37:37,kevin.z.m.zh写道:

jons...@gmail.com

unread,
Apr 29, 2015, 9:20:21 AM4/29/15
to kevin....@gmail.com, achun liu, linux...@googlegroups.com
On Tue, Apr 28, 2015 at 10:37 PM, kevin....@gmail.com
<kevin....@gmail.com> wrote:
> Hi,
>
> The encoder allows you to set the MaxQp(0~51), MinQp(0~51), and MaxBitrate
>
> parameters. MaxQp and MinQp are used to controlpicture quality and
> MaxBitrate
>
> is used to clamp the maximum encoding bit rate within the bitrate
> statistical
>
> time;
>
> The default configuration is MinQp = 10; MaxQp = 40. If you could not get
>
> it to work for lower bitrates , please try to change MaxQp to a bigger
> value,

The bitrate setting on an h.264 encoder is supposed to take precedence
and be a hard limit. So if I set 500Kb/sec the encoder has to adjust
everything else until it can hit and hold that limit. Min/MaxQp should
not overrule the Bitrate limit. I believe the only exception to that
is for VBR where you are allowed to exceed the bandwidth limit by 10%
for short periods of time. The encoder is also supposed to be smart on
how it adjusts itself when the bandwidth limit is set.

These limits are there for streaming video. I needed to set a 500Kb/s
hard limit because I only had 500Kb/s of streaming capacity available.
I couldn't figure out how to keep the Allwinner encoder at a 500Kb/s
limit, it would stay at 500Kb/s for a while but then if there was
rapid motion it would jump to 2Mb/s. It should not matter if CBR or
VBR is set, the limit should still be enforced. Of course when it
jumped to 2Mb/s on my 500Kb/s pipe, the stream dropped.

Check out the the software x86 h.264 implementations - they will
output exactly 500Kb/s when told to. You can watch the picture become
very clear when the scene is still and then go grainy when there is
rapid motion.

Also - I had severe problems with noise on A20 cameras. That noise is
random from frame to frame. Encoding that noise wastes all of my
500Kb/s bandwidth which makes the image quality terrible. Typical
some type of ISP is used to remove this noise before h.264 encoding.

Does the Allwinner V3 support external I2S? I'd just look in the
datasheet, but it is too much hassle to get it.
--
Jon Smirl
jons...@gmail.com

kevin....@gmail.com

unread,
May 5, 2015, 12:00:27 AM5/5/15
to jonsmirl, achun liu, linux...@googlegroups.com
Nowadays, the limits of streaming video can't be controlled accurately
with every frame, but an average in a period. On the A20 platform, it
can't reach 500kb/s with 720p@30fps, the lowest value should be 1.5Mb/s.


>Check out the the software x86 h.264 implementations - they will
>output exactly 500Kb/s when told to. You can watch the picture become
>very clear when the scene is still and then go grainy when there is
>rapid motion.
>
>Also - I had severe problems with noise on A20 cameras. That noise is
>random from frame to frame. Encoding that noise wastes all of my
>500Kb/s bandwidth which makes the image quality terrible. Typical
>some type of ISP is used to remove this noise before h.264 encoding.
>
There may be 3 main factors causing noise, they are lens, Sensor and
ISP. A20 has none local ISP, selecting an external ISP may reduce the
noise. Besides ISP, the lens and Sensor is important too, and the NT99141
is recommended.


>Does the Allwinner V3 support external I2S? I'd just look in the
>datasheet, but it is too much hassle to get it.
Yes, V3 can support external IIS.
We will make the documents for v3 ready as soon as possible.

----------------
Best Regards,
kevin.z.m

jons...@gmail.com

unread,
May 5, 2015, 9:21:49 AM5/5/15
to kevin....@gmail.com, achun liu, linux...@googlegroups.com
That was an important bit of information that should have been in the
datasheet. It would have saved me a huge amount of time messing with
the A20 if I had known 500Kb was never going to be possible.


>
>>Check out the the software x86 h.264 implementations - they will
>>output exactly 500Kb/s when told to. You can watch the picture become
>>very clear when the scene is still and then go grainy when there is
>>rapid motion.
>>
>>Also - I had severe problems with noise on A20 cameras. That noise is
>>random from frame to frame. Encoding that noise wastes all of my
>>500Kb/s bandwidth which makes the image quality terrible. Typical
>>some type of ISP is used to remove this noise before h.264 encoding.
>>
> There may be 3 main factors causing noise, they are lens, Sensor and
> ISP. A20 has none local ISP, selecting an external ISP may reduce the
> noise. Besides ISP, the lens and Sensor is important too, and the NT99141
> is recommended.
>
>>Does the Allwinner V3 support external I2S? I'd just look in the
>>datasheet, but it is too much hassle to get it.
> Yes, V3 can support external IIS.
> We will make the documents for v3 ready as soon as possible.

Can the V3 hit 500Kb/s for h.264?

Currently we are using the Grain Media GM8138S. It is very nice with
the 128MB of DRAM in the same package. We also looked at the
Highsilicon Hi3518e but it gets way too hot. We use GM8138S with
2-channel I2S.

What we really need is:
1) 8-channel I2S
2) Camera that can do low noise, 720P or 1080P video at 500Kb/s (security video)
3) Runs Android
4) The unit is headless so no display
5) OpenCL on the GPU would be a bonus.

I have not found this combination is a low cost chip that works.


>
> ----------------
> Best Regards,
> kevin.z.m
>



--
Jon Smirl
jons...@gmail.com

kevin....@gmail.com

unread,
May 7, 2015, 7:03:24 AM5/7/15
to jonsmirl, achun liu, linux...@googlegroups.com
For static scenes with little noise, V3 and A83T can reach 500kbps for
720p@30pfs or 1080p@15fps.

> 
>Currently we are using the Grain Media GM8138S. It is very nice with
>the 128MB of DRAM in the same package. We also looked at the
>Highsilicon Hi3518e but it gets way too hot. We use GM8138S with
>2-channel I2S.
> 
>What we really need is:
>1) 8-channel I2S
V3 can support 8 channel I2S with one data wire.

>2) Camera that can do low noise, 720P or 1080P video at 500Kb/s (security video)
Take reference from the above.

>3) Runs Android
Because V3 has no GPU, it's difficult to run a complete Android.

>4) The unit is headless so no display
>5) OpenCL on the GPU would be a bonus.
V3 has no GPU module, can't support OpenCL.

>
>I have not found this combination is a low cost chip that works.
> 
> 
>
> ----------------
> Best Regards,
> kevin.z.m
>
> 
> 
> 
>--
>Jon Smirl

jons...@gmail.com

unread,
Jun 2, 2015, 3:15:01 PM6/2/15
to kevin....@gmail.com, achun liu, linux...@googlegroups.com
I'm still interested in the V3 and the V3S. How much DRAM in the V3S?
Is there a datasheet yet? Since me the Chinese one and I will have
someone translate.

I have a Grain Media dev kit on my desk for the GM8138S and we've
built two rounds of prototype PCBs. Our main complaint with the
GM8138S has been one SDIO port. But Grain fixed this with the GM8136S
which has two SDIO ports. GM8138S does pretty nice 720P h.264 at
500Kb/s which we need. 1080P also works at 500Kb/s but it is not so
nice. GM8136S is 720P only, we may drop 1080P since we don't have the
bandwidth for it. Our GM8136S dev kit is not here yet.

We need two SDIO -- one for SD card, one for SDIO 5Ghz wifi. Right
now we have the Ampak AP6330 designed in. But it is 1.8V and Grain is
3.3V so we use level shifters. But AP6330 is cheap since it is old
5Ghz 11N, not 11AC which is 2x the price. We need 5Ghz, 2.4Ghz is too
congested in some areas, but we don't need 11ac speed/cost. Any better
ideas on how to get 2.4/5Ghz wi-fi plus BLE for under $5?

We also require I2S to allow an external codec with built-in amp. We
use a 30W PWM digital amp chip.

Another Grain complaint - they are on Linux 3.3. That is over two
years old. I have been unsuccessful trying to push them onto a more
recent kernel. They are made a major mistake in picking 3.3 since it
is not a Long-term support kernel. So no security patches for it.

We looked at HiSilicon. But they don't have a chip combination with
built-in DRAM and the right peripherals we need.

On Thu, May 7, 2015 at 7:03 AM, kevin....@gmail.com
<kevin....@gmail.com> wrote:
--
Jon Smirl
jons...@gmail.com
Reply all
Reply to author
Forward
0 new messages