adafruit / pi_video_looper

Application to turn your Raspberry Pi into a dedicated looping video playback device, good for art installations, information displays, or just playing cat videos all day.
GNU General Public License v2.0
467 stars 242 forks source link

Increase gpu_mem to avoid hangs #31

Open mangtronix opened 7 years ago

mangtronix commented 7 years ago

Video playback was hanging for me after a few minutes and I was able to resolve it by increasing the GPU memory in /boot/config.txt. This could be added to the install script. gpu_mem=128 seems to work fine for me, but 256 also seems recommended (http://kodi.wiki/view/Raspberry_Pi_FAQ#Memory_Usage)

Issue: video hanging after a few minutes of playback OS: Raspbian Jessie Pixel HW: RPi 3 Fix: add "gpu_mem=128" to /boot/config.txt

pi@raspberrypi:~ $ cat /etc/os-release PRETTY_NAME="Raspbian GNU/Linux 8 (jessie)" NAME="Raspbian GNU/Linux" VERSION_ID="8" VERSION="8 (jessie)" ID=raspbian ID_LIKE=debian HOME_URL="http://www.raspbian.org/" SUPPORT_URL="http://www.raspbian.org/RaspbianForums" BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

Anonymousdog commented 6 years ago

FWIW, my code for doing this for various RPi hardware (in this project) is:

# Set a reasonable GPU memory allocation
# Determine total physical memory
# System Memory
sysmem="`free -m | grep Mem: | awk '$1=$1' | cut -f 2 -d " "`"
# GPU Memory
gpumem="`sudo raspi-config nonint get_config_var gpu_mem /boot/config.txt`"
# Total Mem
physmem=$((gpumem + sysmem))
if [ "$physmem" -lt "500" ]; then
    split=96
    else
    if [ "$physmem" -lt "1000" ]; then
        split=192
        else
        split=256
    fi
fi
# Ask whether there's a custom split desired
echo -n "Enter a custom gpu split if desired [gpu memory in MB] or [Enter] to use recommended split"
read
if [ "$REPLY" != "" ]; then
    if [ "$REPLY" -ge "64" -a "$REPLY" -le "512" ]; then
        split="$REPLY"
    fi
fi
# Set the split
if [ "`raspi-config nonint get_config_var gpu_mem /boot/config.txt`" -lt "$split" ]; then
    echo "Setting gpu_mem allocation to "$split"MB"
    raspi-config nonint do_memory_split "$split"
fi