Discussion:
[Libav-user] Speedup FFmpeg h264 Decoding on Android-Devices
Christian Brümmer
2012-08-04 12:11:26 UTC
Permalink
Hi,

i am using FFmpeg for H264 Decoding on an Android Device. The
Videoframes are encoded on a desktop pc and streamed frame-by-frame to
the phone.
For my tests i used Samsung Galaxy S2 (2x 1,2 ghz) but the decoding time
is between 27 - 31 ms for one Frame with the resolution of 800 x 480
(nativ display res of the s2). I already compiled FFmpeg with Neon Support.

My x264-Encoding Options are:
av_opt_set(mCodec->priv_data, "profile", "baseline", 0);
av_opt_set(mCodec->priv_data, "preset", "medium", 0);
av_opt_set(mCodec->priv_data, "tune", "zerolatency", 0);
av_opt_set(mCodec->priv_data, "x264opts", "rc-lookahead=0", 0);

I used zerolatency because i need a very low latency (and need to encode
parallel more than one videostream - which is working so far) between
video encoding and setting the decoded videoframe to screen (on the
smartphone display).
Which settings could help to speedup h264 decoding (without reducing
display resolution). For example I would like to combine zerolatency and
the fast-decode tune but i dont know how to do this!

Best regards,
Christian
Michael Bradshaw
2012-08-04 14:05:52 UTC
Permalink
Post by Christian Brümmer
Hi,
i am using FFmpeg for H264 Decoding on an Android Device.
Out of curiosity, is there a reason you aren't using Android's native
decoder? It may be more optimized for the device than FFmpeg too. Sorry I
don't know how to make FFmpeg faster.

--Michael
Christian Brümmer
2012-08-04 14:22:24 UTC
Permalink
For sure i first tried to use the Android MediaPlayer in combination
with a RTSP-Stream but it has a - not configurable - frame buffer which
size dependends of the rtsp fps. The result is a delay about 3-5 seconds
which is a known problem as i discovered.
so for a real time video application your on your own..

But anyway i thought there might be a few lever (on the encoding system)
which i have to move to increase the decoding performance!

What about the fast-decoding tune - how can i combine that with my zero
latency configuration?
Post by Michael Bradshaw
Post by Christian Brümmer
Hi,
i am using FFmpeg for H264 Decoding on an Android Device.
Out of curiosity, is there a reason you aren't using Android's native
decoder? It may be more optimized for the device than FFmpeg too.
Sorry I don't know how to make FFmpeg faster.
--Michael
_______________________________________________
Libav-user mailing list
http://ffmpeg.org/mailman/listinfo/libav-user
Hendrik Leppkes
2012-08-04 14:55:12 UTC
Permalink
Post by Christian Brümmer
What about the fast-decoding tune - how can i combine that with my zero
latency configuration?
You should be able to provide a comma separated list for the tune
parameter, try "zerolatency,fastdecode"
Alex Cohn
2012-08-04 15:52:53 UTC
Permalink
For sure i first tried to use the Android MediaPlayer in combination with
a RTSP-Stream but it has a - not configurable - frame buffer which size
dependends of the rtsp fps. The result is a delay about 3-5 seconds which
is a known problem as i discovered.
so for a real time video application your on your own..
You could directly call the built-in stagefreight avc decoder, this
approach does not introduce extra latency. But the number of instances is
limited - three or four, not more.

BR,
Alex Cohn
But anyway i thought there might be a few lever (on the encoding system)
which i have to move to increase the decoding performance!
What about the fast-decoding tune - how can i combine that with my zero
latency configuration?
Post by Michael Bradshaw
Post by Christian Brümmer
Hi,
i am using FFmpeg for H264 Decoding on an Android Device.
Out of curiosity, is there a reason you aren't using Android's native
decoder? It may be more optimized for the device than FFmpeg too. Sorry I
don't know how to make FFmpeg faster.
Post by Michael Bradshaw
--Michael
_______________________________________________
Libav-user mailing list
http://ffmpeg.org/mailman/listinfo/libav-user
_______________________________________________
Libav-user mailing list
http://ffmpeg.org/mailman/listinfo/libav-user
Christian Brümmer
2012-08-04 18:20:49 UTC
Permalink
Okay i will consider that if i am not able to speedup ffmpeg decoding.

First I will post my results after using the x264opts Hendrik provides (
"zerolatency,fastdecode" ).
Post by Christian Brümmer
Post by Christian Brümmer
For sure i first tried to use the Android MediaPlayer in combination
with a RTSP-Stream but it has a - not configurable - frame buffer
which size dependends of the rtsp fps. The result is a delay about 3-5
seconds which is a known problem as i discovered.
Post by Christian Brümmer
so for a real time video application your on your own..
You could directly call the built-in stagefreight avc decoder, this
approach does not introduce extra latency. But the number of instances
is limited - three or four, not more.
BR,
Alex Cohn
Post by Christian Brümmer
But anyway i thought there might be a few lever (on the encoding
system) which i have to move to increase the decoding performance!
Post by Christian Brümmer
What about the fast-decoding tune - how can i combine that with my
zero latency configuration?
Post by Christian Brümmer
On Aug 4, 2012 6:11 AM, "Christian Brümmer"
Post by Christian Brümmer
Hi,
i am using FFmpeg for H264 Decoding on an Android Device.
Out of curiosity, is there a reason you aren't using Android's
native decoder? It may be more optimized for the device than FFmpeg
too. Sorry I don't know how to make FFmpeg faster.
Post by Christian Brümmer
--Michael
_______________________________________________
Libav-user mailing list
http://ffmpeg.org/mailman/listinfo/libav-user
_______________________________________________
Libav-user mailing list
http://ffmpeg.org/mailman/listinfo/libav-user
_______________________________________________
Libav-user mailing list
http://ffmpeg.org/mailman/listinfo/libav-user
Christian Brümmer
2012-08-05 13:17:44 UTC
Permalink
I tried the "zerolatency,fastdecode" combination and the results are
amazing!

Before fastdecode the avg (about~ 200 measurements) was 19,8 ms per
frame. Now on fastdecode (if iam not doing anything wrong) the avg is
10,52. Almost the half of the processing time.
The avg framesize for both is exact the same: 11722 bytes (for the first
300 frames).

This is great and it is enough for my application environment! Thanks
for the help!
Post by Christian Brümmer
Okay i will consider that if i am not able to speedup ffmpeg decoding.
First I will post my results after using the x264opts Hendrik provides
( "zerolatency,fastdecode" ).
On Aug 4, 2012 5:22 PM, "Christian Brümmer"
Post by Christian Brümmer
For sure i first tried to use the Android MediaPlayer in
combination with a RTSP-Stream but it has a - not configurable -
frame buffer which size dependends of the rtsp fps. The result is a
delay about 3-5 seconds which is a known problem as i discovered.
Post by Christian Brümmer
so for a real time video application your on your own..
You could directly call the built-in stagefreight avc decoder, this
approach does not introduce extra latency. But the number of
instances is limited - three or four, not more.
BR,
Alex Cohn
Post by Christian Brümmer
But anyway i thought there might be a few lever (on the encoding
system) which i have to move to increase the decoding performance!
Post by Christian Brümmer
What about the fast-decoding tune - how can i combine that with my
zero latency configuration?
Post by Christian Brümmer
On Aug 4, 2012 6:11 AM, "Christian Brümmer"
Post by Christian Brümmer
Hi,
i am using FFmpeg for H264 Decoding on an Android Device.
Out of curiosity, is there a reason you aren't using Android's
native decoder? It may be more optimized for the device than FFmpeg
too. Sorry I don't know how to make FFmpeg faster.
Post by Christian Brümmer
--Michael
_______________________________________________
Libav-user mailing list
http://ffmpeg.org/mailman/listinfo/libav-user
_______________________________________________
Libav-user mailing list
http://ffmpeg.org/mailman/listinfo/libav-user
_______________________________________________
Libav-user mailing list
http://ffmpeg.org/mailman/listinfo/libav-user
_______________________________________________
Libav-user mailing list
http://ffmpeg.org/mailman/listinfo/libav-user
cczscq
2013-04-17 10:02:38 UTC
Permalink
"i am using FFmpeg for H264 Decoding on an Android Device. The
Videoframes are encoded on a desktop pc and streamed frame-by-frame to
the phone. "
I want to decode h264 using ffmpeg, frame by frame.But I just know a little
about ffmpeg.
Can you send a demo to me.
email to:***@gmail.com
Thanks,very much.



--
View this message in context: http://libav-users.943685.n4.nabble.com/Libav-user-Speedup-FFmpeg-h264-Decoding-on-Android-Devices-tp4655525p4657297.html
Sent from the libav-users mailing list archive at Nabble.com.

Loading...