Recherche avancée

Médias (0)

Mot : - Tags -/clipboard

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (86)

  • La file d’attente de SPIPmotion

    28 novembre 2010, par

    Une file d’attente stockée dans la base de donnée
    Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
    Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...)

  • Multilang : améliorer l’interface pour les blocs multilingues

    18 février 2011, par

    Multilang est un plugin supplémentaire qui n’est pas activé par défaut lors de l’initialisation de MediaSPIP.
    Après son activation, une préconfiguration est mise en place automatiquement par MediaSPIP init permettant à la nouvelle fonctionnalité d’être automatiquement opérationnelle. Il n’est donc pas obligatoire de passer par une étape de configuration pour cela.

  • Gestion des droits de création et d’édition des objets

    8 février 2011, par

    Par défaut, beaucoup de fonctionnalités sont limitées aux administrateurs mais restent configurables indépendamment pour modifier leur statut minimal d’utilisation notamment : la rédaction de contenus sur le site modifiables dans la gestion des templates de formulaires ; l’ajout de notes aux articles ; l’ajout de légendes et d’annotations sur les images ;

Sur d’autres sites (4389)

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

    28 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.

  • ffmpeg concatenating videos of different fps while keeping the total length not changed

    23 novembre 2017, par A_Matar

    I wanna pad an mp4 video stream with another video clip of a static image that I created using :

    def generate_white_vid (duration):
       output_filename = os.path.join(p_path,'white_vid_'+" 0:.2f}".format(duration)+'.mp4')
       ffmpeg_create_vid_from_static_img = 'ffmpeg -loop 1 -i /path/WhiteBackground.jpg -c:v libx264 -t %f -pix_fmt yuv420p -vf scale=1920:1080 %s' % (duration, output_filename)
       p = subprocess.Popen(ffmpeg_create_vid_from_static_img, shell=True)
       p.communicate()
       return output_filename

    I use the following to concatenate :

    def concat_vids(clip_paths):
       filenames_txt = open('clips_to_join.txt','w')
       for clip in clip_paths:
           filenames_txt.write ('file \''+ clip+'\'\n')
       filenames_txt.close()
       output_filename = clip_paths[0].split('.', 2)[0]
       output_file_path = os.path.join(root_path, output_filename+'-padded.mp4')
       # join the clips
       ffmpeg_command = ["ffmpeg", "-f", "concat", "-safe", "0", "-i", "clips_to_join.txt", "-codec", "copy", output_file_path] # output_filename = ch0X-start_time-end_time
       p = subprocess.Popen(ffmpeg_command)
       p.communicate() # wait till the subprocess finishes. You can send commands to process as well.
       return output_file_path

    When I check the length of the resulting video after concatenation, I find that it is not equal to the sum of the two segments that I concatenated, and sometimes it is even less by some seconds !!

    Here is how I get the video length in seconds :

    def ffmpeg_len(vid_path):
       '''
       Returns length in seconds using ffmpeg
       '''
       ffmpeg_get_mediafile_length = ['sh', '-c', 'ffmpeg -i "$1" 2>&1 | grep Duration', '_', vid_path]
       p = subprocess.Popen(ffmpeg_get_mediafile_length, stdout=subprocess.PIPE, stderr=subprocess.PIPE)    
       output, err = p.communicate()
       length_regexp = 'Duration: (\d{2}):(\d{2}):(\d{2})(\.\d+),'
       re_length = re.compile(length_regexp)
       matches = re_length.search(output)
       if matches:
           video_length = int(matches.group(1)) * 3600 + \
                           int(matches.group(2)) * 60 + \
                           int(matches.group(3)) + float(matches.group(4))
           return video_length
       else:
           print("Can't determine video length.")
           print err
           raise SystemExit

    My guess is that maybe the concatenation unifies the fps rate for the all the clips to be joined, if this is the case, how to prevent this from happening ? How can I get a video of the desired length exactly.

    Maybe it worth mentioning that the video to padded is very short 0.42 second, the original video is 210.58 and the resultant video is 210.56 !

    I have verified that ffmpeg does generate the desired padding region and it is of the desired length 0.42 I got a 0.43 segment when I forced 30 fps but it is okay.

  • ffmpeg - how can I scale the video while perserving the total frames in it ?

    14 juin 2018, par choz

    I have a video with a size of 515 x 755, that I would like to resize proportionally to 206 x 302 (so, factor is 2.5).

    In this video, I have the total of 588 frames, and I use ffmpeg to scale it, with this command.

    ffmpeg -i video.mp4 -vf scale=206:-1 xRotation_206.mp4

    And I use this to check how many frames are there in the video, based on this answer.

    ffmpeg -i video.mp4 -map 0:v:0 -c copy -f null - 2>&1 | awk '/frame=/ {print $2}'

    The original video frames is good (588 frames). But, after resizing with the command above, my converted video now has 604 frames.

    The question is, how can I resize the video by preserving the total frames in it ? It doesn’t really have to be ffmpeg approach, and any suggestion is appreciated.

    Here’s the sample video that I use : Link