Manders
Posts: 4
Joined: Sun Sep 16, 2012 8:39 pm

omxplayer lag

Sun Sep 16, 2012 9:00 pm

Hopefully this will be a pretty simple issue for some of you guys here. I'm trying to watch some HD video (720p not 1080p) on my pi and I'm experiencing some video lag and low frame rates. The audio seems fine, but the video sometimes stutters and gets behind the audio.

- My current frame rate upon running omxplayer is about 24.
- I have already set my ram to 50/50.
- I am using Raspian.

Thanks to anyone who can help.

elatllat
Posts: 1337
Joined: Sat Dec 17, 2011 5:05 pm

Re: omxplayer lag

Mon Sep 17, 2012 4:39 pm

odd, what is the output of this:

Code: Select all

apt-get install -y mediainfo;
mediainfo /path/to/file_with.problem;
SBC with 32GB RAM: https://hardkernel.com

FAQ : https://raspberrypi.stackexchange.com

Unanswered: https://www.raspberrypi.org/forums/search.php?search_id=unanswered

Manders
Posts: 4
Joined: Sun Sep 16, 2012 8:39 pm

Re: omxplayer lag

Mon Sep 17, 2012 10:27 pm

elatllat wrote:odd, what is the output of this:

Code: Select all

apt-get install -y mediainfo;
mediainfo /path/to/file_with.problem;
Thanks for the reply.

Code: Select all

General
Complete name                            : nichijou24
Format                                   : AVI
Format/Info                              : Audio Video Interleave
File size                                : 290 MiB
Duration                                 : 23mn 39s
Overall bit rate                         : 1 712 Kbps

Video
ID                                       : 0
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L3.1
Format settings, CABAC                   : Yes
Format settings, ReFrames                : 4 frames
Codec ID                                 : H264
Duration                                 : 23mn 39s
Bit rate                                 : 1 500 Kbps
Width                                    : 1 280 pixels
Height                                   : 720 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Variable
Frame rate                               : 23.976 fps
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.068
Stream size                              : 266 MiB (92%)
Writing library                          : x264 core 125 r2208 d9d2288
Encoding settings                        : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=7 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=12 / lookahead_threads=2 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=23 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=abr / mbtree=1 / bitrate=1500 / ratetol=1.0 / qcomp=0.60 / qpmin=0 / qpmax=51 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00
Matrix coefficients                      : SMPTE 240M

Audio
ID                                       : 1
Format                                   : MPEG Audio
Format version                           : Version 1
Format profile                           : Layer 3
Codec ID                                 : 55
Codec ID/Hint                            : MP3
Duration                                 : 23mn 39s
Source duration                          : 23mn 39s
Bit rate mode                            : Constant
Bit rate                                 : 128 Kbps
Channel(s)                               : 2 channels
Sampling rate                            : 48.0 KHz
Compression mode                         : Lossy
Stream size                              : 21.7 MiB (7%)
Alignment                                : Split accross interleaves
Interleave, duration                     : 24 ms (0.58 video frame)

Genius23008
Posts: 54
Joined: Sun Jun 03, 2012 6:50 am

Re: omxplayer lag

Wed Sep 19, 2012 5:06 am

OMXplayer ideally works with 64MB of RAM allocated to the GPU. OMXplayer used to not work at all for me - after assigning 64 instead of 16 and renaming my video files, I can watch 1080p without any lag at all. Has your movie file got spaces in it's name? Try removing them and playing it.
Hope that helps.

fredjam
Posts: 83
Joined: Thu Jul 19, 2012 3:19 am
Location: London UK

Re: omxplayer lag

Wed Sep 19, 2012 11:43 pm

I use the 192/64 memory split and I can play HD video with surround sound without any lag.
The must be something in your setup that is consuming CPU processing power. In any case
you need to give a lot more information about your set up. What are you playing these movies
from? Where did you get the movie files from? Is your pi over clocked? Are you playing them
and the sound through HDMI?

Manders
Posts: 4
Joined: Sun Sep 16, 2012 8:39 pm

Re: omxplayer lag

Thu Sep 20, 2012 12:39 am

Genius23008 wrote:OMXplayer ideally works with 64MB of RAM allocated to the GPU. OMXplayer used to not work at all for me - after assigning 64 instead of 16 and renaming my video files, I can watch 1080p without any lag at all. Has your movie file got spaces in it's name? Try removing them and playing it.
Hope that helps.
Yeah that's why I'm somewhat confused on why this is happening. My files don't have spaces in their names, but thanks for the thought.
fredjam wrote:I use the 192/64 memory split and I can play HD video with surround sound without any lag.
The must be something in your setup that is consuming CPU processing power. In any case
you need to give a lot more information about your set up. What are you playing these movies
from? Where did you get the movie files from? Is your pi over clocked? Are you playing them
and the sound through HDMI?
The movies are being played straight from the SD card. I got the videos via torrent and direct download from various sites. The videos run perfectly fine on my PC. My pi isn't overclocked, and the sound is coming through HDMI.

fredjam
Posts: 83
Joined: Thu Jul 19, 2012 3:19 am
Location: London UK

Re: omxplayer lag

Fri Sep 21, 2012 5:06 am

Yes but you are still not providing all the information we need. What operating system are you using.
I use the latest version of Raspian, fully updated, and I use omxplayer to play videos. If videos
don't play on your pi then it must be different from from the standard set up.. You need to work out
what is different on your pi.

Genius23008
Posts: 54
Joined: Sun Jun 03, 2012 6:50 am

Re: omxplayer lag

Fri Sep 21, 2012 8:00 pm

By the way, if anyone wants to know, I am used to be using the older wheezy, and that had no lag, and it's even faster in the new wheezy with Turbo Mode enabled. Just out of question, what kind of movie files are they? What is the audio encoded as? Just to point out, I was using h.264 video with AAC as sound. Try converting to that.
Hope that helps.

Manders
Posts: 4
Joined: Sun Sep 16, 2012 8:39 pm

Re: omxplayer lag

Sat Sep 22, 2012 12:43 am

From talking to others I have figured out that the pi has trouble playing files in the AVI container. This is what was causing the lag, because the video played perfectly when I converted it to MP4.

Thanks to everyone who helped.

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5537
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: omxplayer lag

Sat Sep 22, 2012 10:47 am

Manders wrote:From talking to others I have figured out that the pi has trouble playing files in the AVI container. This is what was causing the lag, because the video played perfectly when I converted it to MP4.

Thanks to everyone who helped.
If you post a link to a sample of the video (e.g. produce a 100MB sample), then it can be investigated.
I'm not aware of any problem with avi files. (Although avi doesn't naturally support B frames, so the "packed frame" hack used may be causing a problem).

Return to “Troubleshooting”