WIP Skin video backdrops - Printable Version +- Kodi Community Forum (https://forum.kodi.tv) +-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32) +--- Forum: Kodi Application (https://forum.kodi.tv/forumdisplay.php?fid=93) +--- Thread: WIP Skin video backdrops (/showthread.php?tid=157585) |
Skin video backdrops - leechguy - 2013-02-25 Hi dev's, I'm trying to implement a new class CGUIVideoBackground to enable skins to play a video loop in the background. As a proof of concept this more or less works and I find the effect really beautiful. There is however one thing that is not so beautiful and that is the fact that the video loop is not seamless. When the video restarts, for a very brief, but very noticable moment the background becomes black. At first I thought it was something with my code (which basically is a stripped version of the CApplication:layFile() function) so I decided to do a small test and copy the video that I use 3 times and rename the files such that they appear as a single stacked video in XBMC. I then noticed that unfortunately, this stacked video also shows the black background when it moves from one video in the stack to the next. For normal stacked videos this does not seem to be a problem because they get cut at the end of a scene and you don't really notice it. Basically, I'm looking for some hints and tips to overcome this limitation. I was thinking about introducing a new URI in CDVDFactoryInputStream::CreateInputStream() called 'loop://'. When encountered this would then instantiate a CDVDInputStreamFileLoop object. The CDVDInputStreamFileLoop class would be derived from CDVDInputStreamFile and would when the end of the video file is reached simply seek to the beginning of the file. Now I'm wondering whether or not this is the right approach, or if there are better solutions. Edit: Updated title, was "Seamless playback of video loop?" RE: Skin video backdrops - leechguy - 2013-03-02 I have updated the post title to better reflect exactly what it is that I'm working on. Good progress has been made. The looping of the video is now seamless; no more black background when the video restarts. At the moment I have solved this only for the DVDPlayer player by updating the CDVDPlayer::ReadPacket() function: Code: // read a data frame from stream. When the end of the file is reached, I simply seek to the start of the file and do another attempt to read the packet. So far this works very well. It actually saves me from requiring the use of the "loop://" URI and CDVDInputStreamFileLoop class that I first had in mind. I have been going through the code of the OMXPlayer and it seems like the same change may apply there. For the AMLPlayer I'm not sure yet. Questions that I have regarding the AMLPlayer and OMXPlayer:
Questions that I have regarding the architecture:
Any hints, tips, remarks, whatever are most welcome. RE: Skin video backdrops - Ace - 2013-03-02 Hi leechguy, great that you started working at this! I think that Code: !packet Regards ace RE: Skin video backdrops - leechguy - 2013-03-02 I think you're right. I have moved the code into the Process() function, this seems to be the better location just before all players are told that the end of the file has been reached: Code: // input stream asked us to just retry RE: Skin video backdrops - leechguy - 2013-04-03 A small update on current progress. I have been playing 'a bit' more with the proof of concept and have been creating a CGUIVideoBackground control similar to the CGUIImage control. Next to a video backdrop I now also have video thumbs These could for example be used in List view to show movie trailers instead of the PosterThumb images that are shown at the moment. This already works although I am playing the real movie instead of a trailer (not sure if the trailer filename is available at the moment). When playing both a video backdrop and a 'video thumb' it seems as if both players are playing both videos. So the video backdrop also plays in the video thumb and vica versa with lots of flicker. Of course the players are not really playing two videos each. I have a feeling that this is a problem in the rendering of both videos. The rendering stuff in XBMC is something that I still need to take a good look at. The biggest problem I am facing however is that I may have to come to the sad conclusion that using DVDPlayer may not be suitable at the moment. It simply is not stable when used for this purpose and when using VDPAU it will crash XBMC in no time. When using software decoding it is much more stable, although also not as stable as it must be. A conclusion to which oldnemesis also already came for the karaoke video background. However, using the karoake video player is not an option for me because it lacks hardware accelleration. The coming week I want to investigate whether or not I should refactor the CGUIVideoBackground control and split it into a CGUIVideoBackground and CVideo part, similar to CGUIImage and CTexture. Any hints, tips and/or remarks are most welcome. RE: Skin video backdrops - un1versal - 2013-04-04 Confluence skin use to have a multiimage loading which loaded a bunch of images in sucession as a background basically looked like a video playback (similar), this was removed in Frodo because of resource usage on less poweful platforms but the code is still there and can be used by skins, quite a few do or did.. see http://wiki.xbmc.org/?title=MultiImage_Control It would be more popular if this could be used as addon so if your resources are ok you can download addon and go from there. This multiimage thing could be a video except it was saved as frames/images which is basically what video is lost a frames/images played in succession seamlessly.. uNi RE: Skin video backdrops - leechguy - 2013-04-05 The MultiImage Control is meant for slideshows (e.g. looping through fanart). I don't think that it is particularly well suited for displaying approx. 25~30 different images/second. That would indeed be a bit of a resource problem. A video on the otherhand that is decoded by the GPU is much lighter. I ripped a video from youtube as a 30 frames per second 1080p H.264 video. It uses only 3.1 MB for a movie of 12 seconds. I recorded a little video which shows the current status: RE: Skin video backdrops - un1versal - 2013-04-06 That may be the case, however think of platfoms like rPI and similar, I still think an addon stands better chance if thats even possible as addon. uNi RE: Skin video backdrops - leechguy - 2013-04-07 XBMC can have only one player active at the same time. So if you're playing mp3's with PAPlayer, you can't have DVDPlayer, OMXPlayer or any other player to play the video backdrop because that requires two players to be active at the same time. So to be able to allow for more than one player requires changes in XBMC, this simply is not possible with an addon. I can't say what the result will be on the RPi, ATV and Android devices yet. The RPi is able to run video when not in fullscreen mode, but the menu does not scroll smoothly. Then again, I don't think that anyone is running heavy skins like for example Aeon MQ4 on a RPi either. RE: Skin video backdrops - un1versal - 2013-04-07 Yes but for people that never use anything but default confluence skin will likely never see this "feature" as a addon anyone could. uNi RE: Skin video backdrops - spiff - 2013-04-07 have a look at pr #1137. RE: Skin video backdrops - leechguy - 2013-04-07 Yes, I'm already looking at the karaoke code and the ffmpeg tutorial mentioned in the code comments. I will probably create a prototype using that player to figure out how hard it will be to add hardware acceleration. As a test of this player I tried using Lord of the Rings as a video background in karoake mode. On my Atom/ION2 it sort of works, but in very slow motion so hw acceleration really is a must (not that I plan to use LOTR as a video backdrop, but I do intend to use full HD video backdrops) RE: Skin video backdrops - perkins.jt - 2013-04-29 This is spectacular. Shut up and take my money! RE: Skin video backdrops - leechguy - 2013-05-01 Still needs a lot of work though. I had to down prioritize this a little due to some work on auto login profiles and a skiing holiday. Things should be moving forward again RE: Skin video backdrops - Robotica - 2013-05-13 Great work! You probably have seen the FFMPEG update, which's support decoding and demuxing animated gif's. |