Recherche avancée

Médias (91)

Autres articles (42)

  • Librairies et binaires spécifiques au traitement vidéo et sonore

    31 janvier 2010, par

    Les logiciels et librairies suivantes sont utilisées par SPIPmotion d’une manière ou d’une autre.
    Binaires obligatoires FFMpeg : encodeur principal, permet de transcoder presque tous les types de fichiers vidéo et sonores dans les formats lisibles sur Internet. CF ce tutoriel pour son installation ; Oggz-tools : outils d’inspection de fichiers ogg ; Mediainfo : récupération d’informations depuis la plupart des formats vidéos et sonores ;
    Binaires complémentaires et facultatifs flvtool2 : (...)

  • Support audio et vidéo HTML5

    10 avril 2011

    MediaSPIP utilise les balises HTML5 video et audio pour la lecture de documents multimedia en profitant des dernières innovations du W3C supportées par les navigateurs modernes.
    Pour les navigateurs plus anciens, le lecteur flash Flowplayer est utilisé.
    Le lecteur HTML5 utilisé a été spécifiquement créé pour MediaSPIP : il est complètement modifiable graphiquement pour correspondre à un thème choisi.
    Ces technologies permettent de distribuer vidéo et son à la fois sur des ordinateurs conventionnels (...)

  • De l’upload à la vidéo finale [version standalone]

    31 janvier 2010, par

    Le chemin d’un document audio ou vidéo dans SPIPMotion est divisé en trois étapes distinctes.
    Upload et récupération d’informations de la vidéo source
    Dans un premier temps, il est nécessaire de créer un article SPIP et de lui joindre le document vidéo "source".
    Au moment où ce document est joint à l’article, deux actions supplémentaires au comportement normal sont exécutées : La récupération des informations techniques des flux audio et video du fichier ; La génération d’une vignette : extraction d’une (...)

Sur d’autres sites (6351)

  • Adding total duration/enable seeking in mp4 AAC audio stream file with FFMPEG

    12 avril 2016, par lex82

    I’m trying to write an AAC audio stream into an mp4 file using the FFMPEG libraries. I am using a custom IO context that writes directly to a socket so I have to set ioContext->seekable = 0. To make this work I had to add the "movflags" empty_moov and frag_keyframe when writing the header.

    After writing the output to a file on the other end of the socket, I can play the file in VLC or Windows Media Player. However, seeking to a specific position in the file is not working properly in both players. WMP also does not show the total duration and VLC only flashes it shortly when reaching the end of the audio.

    Is there a way to add more metadata when muxing so the players are able to treat the file as if it was not written as a stream ? Transfer via the socket is not interrupted abruptly, so I could write metadata at the end of the file. I also know the total duration in advance, so I could add it to the header of the file if it was possible. I cannot use the faststart flag because this would require output to a seekable file before writing to the socket.

    Update : I learned that I can set the duration in AVFormatContext and I can set nb_frames and avg_frame_rate in AVStream. However, it doesn’t solve my problem. When I set the codecContext flag AV_CODEC_FLAG_QSCALE, VLC seems to be able to estimate the total time. However, seeking still doesn’t work.

  • Restart ffmpeg process using monit if TOTAL CPU is less than 1%

    15 mai 2017, par user2201239

    I have used kind of similar solution like this Restarting ffmpeg process using monit to restart my ffmpeg stream in case it fails for some reason. Remember its not duplicate problem/question, because I have other issues unlike the example question/solution Restarting ffmpeg process using monit, which I’m gonna explain below. So here is my monit configuration :

       check process FFMPEGStream with pidfile PATH-to-file/streampid.pid
       start program = "PATH-to-file/streambash.sh restart"
       stop program = "PATH-to-file/streambash.sh stop"
       if TOTAL CPU is less than 1% for 10 cycles then restart

    Here is my streambash.sh file :

       #!/bin/bash
       pid_file="PATH-to-file/streampid.pid"

       case "$1" in
        restart)
           PATH-to-file/streambash.sh stop
           PATH-to-file/streambash.sh start
              ;;

        start)
           rm $pid_file
           /usr/bin/ffmpeg -i "INPUT-PATH" -c:v libx264 -b:v 900k -preset ultrafast -aspect 16:9 -s 640x376 -strict experimental -c:a aac -b:a 96k -f flv "RTMP-PATH" &> /dev/null &
           ch_pid=$!
           echo "Start Stream1: ffmpeg = $ch_pid";
           echo $ch_pid > $pid_file
              ;;

        stop)
           echo "Stop ffmpeg Stream1";
           kill `cat $pid_file` &> /dev/null
              ;;

        *)
           echo "Usage: PATH-to-file/streambash.sh {start|stop|restart}"
           exit 1
              ;;

        esac
       exit 0
       echo $pid_file

    Monit can start the bash file successfully, but when this condition "if TOTAL CPU is less than 1% for 10 cycles then restart" is matched in monit configuration, it tries to restart, it gives error that process is not running. But in actual the ffmpeg process still runs in the background and I can see that the stream is live on my website. Here is monit logs :

       [CET Jan 10 12:55:02] error    : 'FFMPEGStream' total cpu usage of 0.4% matches resource limit [cpu usage>1.0%]
       [CET Jan 10 12:55:07] error    : 'FFMPEGStream' total cpu usage of 0.0% matches resource limit [cpu usage>1.0%]
       [CET Jan 10 12:55:12] error    : 'FFMPEGStream' total cpu usage of 0.0% matches resource limit [cpu usage>1.0%]
       [CET Jan 10 12:55:17] error    : 'FFMPEGStream' total cpu usage of 0.4% matches resource limit [cpu usage>1.0%]
       [CET Jan 10 12:55:22] error    : 'FFMPEGStream' total cpu usage of 0.9% matches resource limit [cpu usage>1.0%]
       [CET Jan 10 12:55:27] error    : 'FFMPEGStream' total cpu usage of 0.9% matches resource limit [cpu usage>1.0%]
       [CET Jan 10 12:55:32] error    : 'FFMPEGStream' total cpu usage of 0.0% matches resource limit [cpu usage>1.0%]
       [CET Jan 10 12:55:37] error    : 'FFMPEGStream' total cpu usage of 0.0% matches resource limit [cpu usage>1.0%]
       [CET Jan 10 12:55:42] error    : 'FFMPEGStream' total cpu usage of 0.0% matches resource limit [cpu usage>1.0%]
       [CET Jan 10 12:55:47] error    : 'FFMPEGStream' total cpu usage of 0.4% matches resource limit [cpu usage>1.0%]
       [CET Jan 10 12:55:50] info     : 'FFMPEGStream' trying to restart
       [CET Jan 10 12:55:50] info     : 'FFMPEGStream' stop: PATH-to-file/streambash.sh
       [CET Jan 10 12:55:51] info     : 'FFMPEGStream' start: PATH-to-file/streambash.sh
       [CET Jan 10 12:55:56] error    : 'FFMPEGStream' process is not running
       [CET Jan 10 12:55:58] info     : 'FFMPEGStream' trying to restart
       [CET Jan 10 12:55:58] info     : 'FFMPEGStream' start: PATH-to-file/streambash.sh
       [CET Jan 10 12:56:04] error    : 'FFMPEGStream' process is not running
       [CET Jan 10 12:56:04] info     : 'FFMPEGStream' trying to restart
       [CET Jan 10 12:56:04] info     : 'FFMPEGStream' start: PATH-to-file/streambash.sh
       [CET Jan 10 12:56:09] error    : 'FFMPEGStream' process is not running
       [CET Jan 10 12:56:09] info     : 'FFMPEGStream' trying to restart
       [CET Jan 10 12:56:09] info     : 'FFMPEGStream' start: PATH-to-file/streambash.sh

    Monit keeps trying to restart the process and on each retry, it dumps a new pid to the PATH-to-file/streampid.pid, but as I said it seems, it somehow can stop the actual ffmpeg stream/pid, which keep running in the background.

  • How can I change a video frame rate with FFmpeg keeping the same total number of frames ?

    28 mai 2017, par Nuno

    I’ve been searching for an answer here on Stack Overflow and googling everywhere... even though it seems like it should be a very simple command line to me, I just can’t find an answer anywhere.

    I would like to change the frame rate of a video from 23.976fps to 24fps with FFmpeg, lossless and keeping the total number of frames.

    To make it simpler :

    Let’s say I have a 25fps video with a total lenght of 100 frames.

    How can I change it’s frame rate to 50fps, with FFmpeg, lossless and keeping the same total lenght of 100 frames ?

    This was so far the best solution I came across with (which can be found here) :

    Extract the frames as rawvideo :

    ffmpeg -i input.mov -f rawvideo -b 50000000 -pix_fmt yuv420p -vcodec
    rawvideo -s 1920x1080 -y temp.raw

    Recreate the video with new framerate :

    ffmpeg -f rawvideo -b 50000000 -pix_fmt yuv420p -r 24 -s 1920x1080 -i
    temp.raw -y output.mov

    Note 1 : I had to remove "-b 50000000" when recreating the video with the new frame rate, in order to get it to work properly.

    It did exactly what I intended it to do, but I’m still wondering if there is any simpler way to do this ? I’ve tried to pipe them together in one line only, as suggested in the same post, but couldn’t get it to work.

    Note 2 : Even though it does exactly what I wanted it to do, I’ve just later realized there is quality loss using this method, which I would prefer to avoid.

    Thanks everyone in advance !