Page 1 of 2
[solved]Playing video
Posted: Sat Oct 21, 2017 12:09 pm
by shinprog
Hello,
I'm a French high school student and I'm new in this forum !
I am developing a fan-game in lua and the Love library, because it's a cool programming language and this is like python but there isn't forced indent
!
I want to play a video using your library.I convert this video to a ogv format using vlc,it work...
But when I used the example code in the documentation,
It justs play the sound but not the video in the window
I don't know why that's not display the video but just the sound ...
here's my code :
Code: Select all
function love.load()
video = love.graphics.newVideo("resources/test.ogv")
video:play()
end
function love.draw()
love.graphics.draw(video, 0, 0)
end
and a screenshoot :
If you want the file,please reply me
Thanks for your futures replies !
Re: Playing video
Posted: Sat Oct 21, 2017 12:19 pm
by Sir_Silver
I haven't tested this myself, just a suggestion, have you tried doing
Code: Select all
function love.draw()
love.graphics.setColor(255, 255, 255)
love.graphics.draw(video, 0, 0)
end
I suspect maybe the default color may be black? If that's not it, no clue unfortunately.
Re: Playing video
Posted: Sat Oct 21, 2017 12:24 pm
by bartbes
Sir_Silver wrote: ↑Sat Oct 21, 2017 12:19 pm
I suspect maybe the default color may be black? If that's not it, no clue unfortunately.
Love's default colour is definitely white, since that's almost always what you want when drawing images, text, etc.
shinprog wrote: ↑Sat Oct 21, 2017 12:09 pm
But when I used the example code in the documentation,
It justs play the sound but not the video in the window
I don't know why that's not display the video but just the sound ...
Considering there was no error, it must consider it a valid video, so I'm guessing it's drawing a black frame. If you set the background colour to something other than black you can see whether it's actually drawing anything.
shinprog wrote: ↑Sat Oct 21, 2017 12:09 pm
If you want the file,please reply me
That would probably help.
Re: Playing video
Posted: Sat Oct 21, 2017 1:26 pm
by shinprog
Hello,
thanks for your fast rely
I tried this :
the video seems don't work...It display a simple text and the background is ok,but not the video...
I screenshot with the conf.lua.
In the attachment,the ZIP file of the code
thanks you !
(the video isn't related to the fangame,it's just a test
)
Re: Playing video
Posted: Sat Oct 21, 2017 2:10 pm
by shinprog
This is very strange....
I tried with another video (
http://techslides.com/demos/sample-videos/small.ogv) but it do the same error...
And deleting the conf file don't change the issue...
Help me~~
Re: Playing video
Posted: Sat Oct 21, 2017 3:22 pm
by bartbes
Unfortunately love 0.10.x is a bit picky about which videos it accepts. The next version has had significant fixes and has no issues playing back both videos. In the past I have been able to make videos compatible by remuxing them with ffmpeg.
Re: Playing video
Posted: Sat Oct 21, 2017 3:37 pm
by shinprog
Hello,
would that mean it's an issue from the game engine ?
It is not important that playing a video but is this issue will be fix in a next version?
Re: Playing video
Posted: Sat Oct 21, 2017 3:57 pm
by zorg
I tried your project with (not the latest) 0.11 build, and i only got sound with it too; no video at all.
Re: Playing video
Posted: Sat Oct 21, 2017 6:32 pm
by eliddell
It's something about your video file, all right. After remuxing with ffmpeg, the video portion played back for me in your program (in löve 0.10.2).
Running the original file through ffprobe (which comes with ffmpeg) gave me the following:
[ogg @ 0x23bd2b0] Broken file, keyframe not correctly marked.
Input #0, ogg, from 'test.ogv':
Duration: 00:01:00.21, start: 0.000000, bitrate: 548 kb/s
Stream #0:0: Data: none
Stream #0:1: Video: theora, yuv420p, 320x240 [SAR 1:1 DAR 4:3], 29.97 tbr, 29.97 tbn, 29.97 tbc
Stream #0:2: Audio: vorbis, 44100 Hz, stereo, fltp, 128 kb/s
Metadata:
ENCODER : VLC media player
Unsupported codec with id 0 for input stream 0
Running the remuxed file through the same program gave the following:
Input #0, ogg, from 'test2.ogv':
Duration: 00:01:00.21, start: 0.000000, bitrate: 222 kb/s
Stream #0:0: Video: theora, yuv420p, 320x240 [SAR 1:1 DAR 4:3], 29.97 fps, 29.97 tbr, 29.97 tbn, 29.97 tbc
Metadata:
ENCODER : Lavc57.70.100 libtheora
Stream #0:1: Audio: vorbis, 44100 Hz, stereo, fltp, 112 kb/s
Metadata:
ENCODER : Lavc57.70.100 libvorbis
I'd guess that the problem is either the empty stream #0:0 or the broken keyframe, since those are the only substansive differences.
Re: Playing video
Posted: Sat Oct 21, 2017 7:44 pm
by bartbes
shinprog wrote: ↑Sat Oct 21, 2017 3:37 pm
would that mean it's an issue from the game engine ?
Like I said, it can't play back
some videos.
shinprog wrote: ↑Sat Oct 21, 2017 3:37 pm
It is not important that playing a video but is this issue will be fix in a next version?
And yes, as I said, the next version can play back both videos.
eliddell wrote: ↑Sat Oct 21, 2017 6:32 pm
I'd guess that the problem is either the empty stream #0:0 or the broken keyframe, since those are the only substansive differences.
I'm not sure what the exact issue is, since I did a partial rewrite in the backend, but I know one of the issues I fixed was related to metadata tracks. It looks like both files contain that kind of metadata, and ffmpeg throws it away when remuxing.