
Recherche avancée
Médias (1)
-
Bug de détection d’ogg
22 mars 2013, par
Mis à jour : Avril 2013
Langue : français
Type : Video
Autres articles (89)
-
Personnaliser en ajoutant son logo, sa bannière ou son image de fond
5 septembre 2013, parCertains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;
-
Ecrire une actualité
21 juin 2013, parPrésentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
Vous pouvez personnaliser le formulaire de création d’une actualité.
Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...) -
Publier sur MédiaSpip
13 juin 2013Puis-je poster des contenus à partir d’une tablette Ipad ?
Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir
Sur d’autres sites (8870)
-
What is Funnel Analysis ? A Complete Guide for Quick Results
25 janvier 2024, par Erin -
Conversion Funnel Optimisation : 10 Ways to Convert More
24 janvier 2024, par Erin -
Memory issues when using ffmpeg and gloss to play videos
21 décembre 2015, par NoughtmareI’m trying to make a video player with haskell using ffmpeg-light, JuicyPixels and gloss. I’m now able to play video, but frames that have been played stay in memory. This causes major memory issues. How can I avoid storing all the frames in memory ?
Here is my code :
{-# LANGUAGE FlexibleContexts #-}
module Main where
-- For my own code:
import Graphics.Gloss
import Codec.FFmpeg
import Codec.FFmpeg.Juicy
import Codec.Picture
import Control.Applicative
import Data.Maybe
import Graphics.Gloss.Juicy
import Control.Monad (when, join)
import Codec.FFmpeg.Decode
import Codec.FFmpeg.Enums
import Control.Monad.Error.Class
import Control.Arrow (first)
import Control.Monad.Except (runExceptT)
import Graphics.Gloss.Interface.IO.Animate
import Data.IORef
-- Temporary hardcoded resolution
resolution :: (Int,Int)
resolution = (640, 360)
main :: IO ()
main = do
-- First initialize ffmpeg, this needs to be run before other ffmpeg functions
initFFmpeg
-- Open the samplevideo for reading. video :: IO (IO (Maybe (AVFrame, Double)), IO ())
video <- runExceptT $ frameReaderTime' avPixFmtRgb24 "SampleVideo_640x360_1mb.flv"
either
-- This code gets called when the frameReader reports an error
(const $ putStrLn "Can't read file")
-- This opens a new window and plays the video in it on a white background
(animateFixedIO (InWindow "Nice Window" resolution (10, 10)) white . frameAtWait . fst)
video
-- This finds the frame at given time
frameAtWait :: IO (Maybe (AVFrame, Double)) -> Float -> IO Picture
frameAtWait getFrame time = do
-- This gets the next frame from the video
(frame, t) <- fromJust <$> getFrame
-- t has to be converted from Double to Float
let t' = realToFrac t
-- The difference between the requested time and the actual frame time
difference = t' - time
-- If the frame is not yet supposed to be shown
if difference > 0 then do
-- Wait until it is
threadDelay . round . (* 1000000) $ difference
-- then return it
fromJust <$> frameToPicture frame
else
-- return it immediately
fromJust <$> frameToPicture frame
-- This function converts a ffmpeg internal AVFrame to a gloss picture
frameToPicture :: AVFrame -> IO (Maybe Picture)
frameToPicture frame = do
-- convert it to a juicypixels dynamicimage
dynImage <- toJuicy frame
-- then convert it to a gloss picture and return it
return . join $ fmap fromDynamicImage dynImage