Video delay problem in Android

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Video delay problem in Android

Jump to solution
15,469 Views
sergeikotlyachk
Contributor II

Hi,

My company is trying to make video playing in Android with i.MX6 board to work with live video sources. Unfortunately there is significant delay of 12-14 seconds between changes in the live video and showing these changes on the screen. I was trying various options and came to understanding that root cause of the problem is somewhere in Freescale code in OMX / VPU / GMPlayer, but can't figure out what should I change in firmware in order to reduce this delay. Please help, otherwise we will be unable to use Freescale for our commercial product.

Thanks.

1 Solution
5,985 Views
jack_mao
NXP Employee
NXP Employee

Hi Sergi,

        Here is a patch from our R&D,   you could try on your side.

best regards

Jack

View solution in original post

32 Replies
1,081 Views
jack_mao
NXP Employee
NXP Employee

Hi,

       I just setup my android  to play the mp4 file local, seems no issue, then what's you android release version? By the way how do you setup the vod system , use what's the software to play the video on android?  if it's easy to setup, could you give some detail. I still guess there are network issue such as package lose cause the A/V sync issue,  when you give me the version number, I will added some debug code in the multimedia lib for you test to get  the A/V sync log

0 Kudos
1,080 Views
sergeikotlyachk
Contributor II

I am not sure what you mean by android release version. I have given environment settings that are output by the build before. Is this what you are looking for? PLATFORM_VERSION=4.0.4 If not, please tell me how to determine this version.

0 Kudos
1,081 Views
jack_mao
NXP Employee
NXP Employee

Hi,  I think the PLATFORM_VERSION number is your side, I want to know the fsl android release version. Anyway, I will try to setup such a network environment first.

0 Kudos
1,081 Views
sergeikotlyachk
Contributor II

Is it r13.4.1 number you are looking for?

0 Kudos
1,081 Views
sergeikotlyachk
Contributor II

Playing network streams is very different from playing local files. Please follow these exact steps to reproduce:

1. Install VideoLan (sometimes named VLC) ver 2.0.7 on Windows or Linux (I used Windows 7 64bit). You can download it from http://www.videolan.org

2. copy sample.mp4 to installation directory of VLC

3. Start command line window and go to installation directory of VLC

4. Use this guide for reference: http://www.videolan.org/doc/streaming-howto/en/ch05.html specifically this section: Video On Demand

I used this command vlc --ttl 12 -vvv --color -I telnet --rtsp-host IP_ADDRESS:554    

Where instead of IP_ADDRESS you use actual (not loopback) IP address of the desktop. (you can find it in the output of ipconfig)

5. Use telnet to connect to vlc (it uses port 4212). Don't worry that what you type is not displayed - it is expected. If you don't have telnet on Windows box, you may have to install it using Server Manager or Programs and Features. Or just use PuTTy:

PuTTY Download Page


telnet localhost 4212

6. Issue these commands in telnet which will setup vlc to stream sample.mp4 in VOD mode:

new Test vod enabled

setup Test input sample.mp4

7. Test that vlc running in streaming mode is working by running second instance of vlc with these arguments (replace IP_ADDRESS):

vlc rtsp://IP_ADDRESS:554/Test

8. Install MX player on Freescale board: https://sites.google.com/site/mxvpen/

or

MX Player - Android Apps on Google Play

9. In MX Player select context menu and choose 'Network Stream'

10. Enter rtsp://IP_ADDRESS:554/Test and start timer when video starts showing. Observe delays at 0:30 and 0:40 and stream stopping playing around 55/60 seconds. (entire stream is 1:31)

0 Kudos
1,081 Views
LeonardoSandova
Specialist I

You can reduce it here:

external/fsl_imx_omx/OpenMAXIL/src/component/streaming_parser/StreamingParser.cpp,

#define PACKET_CACHE_SIZE (4*OMX_TICKS_PER_SECOND)

Leo

1,081 Views
sergeikotlyachk
Contributor II

Note: I figured that reducing fps reduces the delay. Reducing resolution also seems to help a little bit. However, even with SD resolution and 5 fps, we still get 2.5 seconds.

There is also another problem, after a little bit of time delay increases to 7 seconds. If streaming application is restarted, delay becomes shorter again.

0 Kudos
1,081 Views
LeonardoSandova
Specialist I

Not sure if it will help but can you add 'enable_wait_mode=off' to your bootargs?

Leo

0 Kudos
1,081 Views
sergeikotlyachk
Contributor II

Unfortunately this did not help (no changes, still high delay after 2-3 minutes of running video).

0 Kudos
1,081 Views
karina_valencia
NXP Apps Support
NXP Apps Support

Employee

Hi,

    what's your meaning "there is significant delay of 12-14 seconds between changes in the live video and showing these changes on the screen"? please give a detail description,  please give a full log when the issue happen,by the way, what's your software version?

0 Kudos
1,081 Views
sergeikotlyachk
Contributor II

1. Setup is simple: ethernet camera that transmits live rtsp stream in H264 and Android application that uses MediaPlayer class shows this video on HDMI HD monitor connected to i.MX6 Quad core board.

2. Delay: when I wave my hand over the camera, it takes 12-14 seconds for it to show in Android application.

(or whatever number of seconds in other situations that I explained in other posts of this thread).

3. What kind of log do you need and how do I get it?

4. Software version:

PLATFORM_VERSION_CODENAME=REL

PLATFORM_VERSION=4.0.4

TARGET_PRODUCT=sabresd_6dq

TARGET_BUILD_VARIANT=user

TARGET_BUILD_TYPE=release

TARGET_BUILD_APPS=

TARGET_ARCH=arm

TARGET_ARCH_VARIANT=armv7-a-neon

HOST_ARCH=x86

HOST_OS=linux

HOST_BUILD_TYPE=release

Linux version 3.0.35-05524-g8513494 (kotl@android1004) (gcc version 4.4.3 (GCC) ) #1 SMP PREEMPT Thu May 2 17:48:46 EDT 2013

0 Kudos
1,081 Views
sergeikotlyachk
Contributor II

Thanks. Using 65536 for PACKET_CACHE_SIZE reduced it to 4.5 seconds. What else can be done? We need this to be 1 sec or less. We connect to live stream directly over local ethernet. VideoLan (VLC) application running on the same network has an negligible delay less than 0.5 second.

0 Kudos