[solved]Playing video

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.
User avatar
shinprog
Prole
Posts: 15
Joined: Sat Oct 21, 2017 11:56 am
Contact:

[solved]Playing video

Post 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 :awesome: !

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 :
Image

If you want the file,please reply me

Thanks for your futures replies !
Last edited by shinprog on Sat Oct 21, 2017 8:08 pm, edited 1 time in total.
I'm a french hight school student who starts programming :)
I'm not very comfortable with english but I'll do my best.

CO-funder of the Kagerou Project Fr Community.
http://kagescan.esy.es http://fb.me/KagerouProjectFr
User avatar
Sir_Silver
Party member
Posts: 286
Joined: Mon Aug 22, 2016 2:25 pm
Contact:

Re: Playing video

Post 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.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Playing video

Post 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.
User avatar
shinprog
Prole
Posts: 15
Joined: Sat Oct 21, 2017 11:56 am
Contact:

Re: Playing video

Post by shinprog »

Hello,
thanks for your fast rely :D

I tried this :
Image

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 ;) )
Attachments
hello world.zip
The source of the code with the video located in /resources/videos
(3.82 MiB) Downloaded 149 times
I'm a french hight school student who starts programming :)
I'm not very comfortable with english but I'll do my best.

CO-funder of the Kagerou Project Fr Community.
http://kagescan.esy.es http://fb.me/KagerouProjectFr
User avatar
shinprog
Prole
Posts: 15
Joined: Sat Oct 21, 2017 11:56 am
Contact:

Re: Playing video

Post 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~~
I'm a french hight school student who starts programming :)
I'm not very comfortable with english but I'll do my best.

CO-funder of the Kagerou Project Fr Community.
http://kagescan.esy.es http://fb.me/KagerouProjectFr
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Playing video

Post 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.
User avatar
shinprog
Prole
Posts: 15
Joined: Sat Oct 21, 2017 11:56 am
Contact:

Re: Playing video

Post 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?
I'm a french hight school student who starts programming :)
I'm not very comfortable with english but I'll do my best.

CO-funder of the Kagerou Project Fr Community.
http://kagescan.esy.es http://fb.me/KagerouProjectFr
User avatar
zorg
Party member
Posts: 3465
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Playing video

Post 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.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
eliddell
Prole
Posts: 20
Joined: Sat Dec 10, 2016 6:38 pm

Re: Playing video

Post 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.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Playing video

Post 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.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 2 guests