Video distortion/corruption on Raspberry Pi 3

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
yoki
Prole
Posts: 9
Joined: Wed Feb 13, 2019 8:50 am

Video distortion/corruption on Raspberry Pi 3

Post by yoki »

I've created a game for a video art installation that is going to be displayed in a few days. And I'm running into the situation in which eventually the video always gets corrupted. I've attached a screen grab for illustration.

I've compiled love from the love-xxx-linux-src.tar.gz files in the bitbucket repo with configure and make. 11.0, 11,1 and 11.2 all show the same behavior.

Sometimes it will take a few hours but eventually it corrupts. Under high cpu load it can occur even after a few seconds.

This is the most basic code I can reproduce it with

Code: Select all

local love = love
local r = {}

function love.load(args)
    love.window.setMode(1280, 720, {
        vsync = false,
        fullscreen = true,
        fullscreentype = "exclusive",
    })
    
    r.intro_video = love.graphics.newVideo("video/effort_7_ff.ogv", { audio = true })
    r.intro_video:play()
end

function love.update(dt)
    if not r.intro_video:isPlaying() then
        r.intro_video:rewind()
        r.intro_video:play()
    end
end

function love.draw()
    local sw, sh = love.graphics.getDimensions()
    if r.intro_video:isPlaying() then
        local vw, vh = r.intro_video:getDimensions()
        love.graphics.setColor(1, 1, 1)
        love.graphics.draw(r.intro_video, 0, 0, 0, sw/vw, sh/vh)
    end
end
The video is transcoded with

Code: Select all

ffmpeg -i effort.mp4 -codec:v libtheora -qscale:v 7 -codec:a libvorbis -qscale:a 7 effort_7_ff.ogv
I can't attach it but I've uploaded it here: https://nofile.io/f/zxXuUQNAhJX/effort_7_ff.ogv

If anyone is able to help me solve this or work around it that would be really appreciated.
Attachments
corruption.webm
(341.18 KiB) Not downloaded yet
yoki
Prole
Posts: 9
Joined: Wed Feb 13, 2019 8:50 am

Re: Video distortion/corruption on Raspberry Pi 3

Post by yoki »

I suspect the corruption to be caused by high cpu load and insufficient resources to decode the stream. However the biggest problem is that I can't seem to detect the corruption: the position updates normally according to video:tell() and it gets rewinded after stopping and will play() again, although it only shows the same few distorted frames.

I also tried reloading the video with love.graphics.newVideo() after each playback but this tends to lock up or crash love2d when there is too much updating or drawing being done.

So the most important questions as of now are:
  • How can I detect it?
  • And how can I fix it without restarting?
pedrosgali
Party member
Posts: 107
Joined: Wed Oct 15, 2014 5:00 pm
Location: Yorkshire, England

Re: Video distortion/corruption on Raspberry Pi 3

Post by pedrosgali »

How much memory are you giving the GPU? Every time I have trouble with a raspberry pi playing video it's because I forgot to increase video memory. You can find it in raspi-config. Essentially they split the RAM between the CPU and GPU but I think it defaults to something really low like 64Mb to the GPU.

Code: Select all

if not wearTheseGlasses() then
  chewing_on_trashcan = true
end
yoki
Prole
Posts: 9
Joined: Wed Feb 13, 2019 8:50 am

Re: Video distortion/corruption on Raspberry Pi 3

Post by yoki »

I have it set to 265 Mb of the 1024 Mb total. I still have some ram left so I could try increasing it to maybe 300, 320?
yoki
Prole
Posts: 9
Joined: Wed Feb 13, 2019 8:50 am

Re: Video distortion/corruption on Raspberry Pi 3

Post by yoki »

I have set it as high as 512 Mb and still got corruption. To trip it I compile love in the background, and the available (non-video) ram stays between the 200-300 Mb. So I think those are both not the problem. Thanks for ruling that out tho!
User avatar
keharriso
Citizen
Posts: 93
Joined: Fri Nov 16, 2012 9:34 pm

Re: Video distortion/corruption on Raspberry Pi 3

Post by keharriso »

I honestly have no idea what's wrong here, nor do I have a way to test/replicate your results. That being said:

1. Maybe it's a temperature issue?
2. Have you tried running the video in, say, VLC and seeing if it gets corrupted too?
LÖVE-Nuklear - a lightweight immediate mode GUI for LÖVE games
yoki
Prole
Posts: 9
Joined: Wed Feb 13, 2019 8:50 am

Re: Video distortion/corruption on Raspberry Pi 3

Post by yoki »

Unfortunately I didn't have the time to test anymore because the installation went live.

Luckilly we got positive reactions on the corruption, and because it enhances the meaning of the piece we left it in. So while the issue isn't resolved it worked out well in the end.

When it's available again I'll try to find out the cause.
Post Reply

Who is online

Users browsing this forum: No registered users and 53 guests