Advanced search

Medias (91)

Other articles (66)

  • La sauvegarde automatique de canaux SPIP

    1 April 2010, by

    Dans le cadre de la mise en place d’une plateforme ouverte, il est important pour les hébergeurs de pouvoir disposer de sauvegardes assez régulières pour parer à tout problème éventuel.
    Pour réaliser cette tâche on se base sur deux plugins SPIP : Saveauto qui permet une sauvegarde régulière de la base de donnée sous la forme d’un dump mysql (utilisable dans phpmyadmin) mes_fichiers_2 qui permet de réaliser une archive au format zip des données importantes du site (les documents, les éléments (...)

  • Script d’installation automatique de MediaSPIP

    25 April 2011, by

    Afin de palier aux difficultés d’installation dues principalement aux dépendances logicielles coté serveur, un script d’installation "tout en un" en bash a été créé afin de faciliter cette étape sur un serveur doté d’une distribution Linux compatible.
    Vous devez bénéficier d’un accès SSH à votre serveur et d’un compte "root" afin de l’utiliser, ce qui permettra d’installer les dépendances. Contactez votre hébergeur si vous ne disposez pas de cela.
    La documentation de l’utilisation du script d’installation (...)

  • Automated installation script of MediaSPIP

    25 April 2011, by

    To overcome the difficulties mainly due to the installation of server side software dependencies, an "all-in-one" installation script written in bash was created to facilitate this step on a server with a compatible Linux distribution.
    You must have access to your server via SSH and a root account to use it, which will install the dependencies. Contact your provider if you do not have that.
    The documentation of the use of this installation script is available here.
    The code of this (...)

On other websites (5741)

  • split the video into five chunks using ffmpeg and batch script

    21 January 2019, by RJFF

    I want to split videos into five chunks using ffmpeg

    the first chunk represents 20% of the whole video
    the second chunk represents 40% of the whole video
    the third chunk represents 60% of the whole video
    the fourth chunk represents 80% of the whole video

    the fifth chunk represents 100% of the whole video

    I write the algorithm but I do not know how to write the batch code:
    1. find the duration of the video
    2. store the duration in variable
    3. divided the duration by 5
    4. split the video

    I want a batch script that takes the duration of the video then store the value of duration in the variable

    this is how I can take the duration of the video

    ffmpeg -i C:\video-splitter-master\1.avi 2>&1 | grep "Duration"| cut -d ' ' -f 4 | sed s/,// | sed 's@\..*@@g' | awk '{ split($1, A, ":"); split(A[3], B, "."); print 3600*A[1] + 60*A[2] + B[1] }'

    but how I can store the duration value in the variable?

    can you please help me?

  • ffmpeg not working in script - moov atom not found

    2 June 2016, by user1490563

    I made a simple script that divides a flv file into multiple parts, converts them all to .mp4 individually and then merge all of them to form a final mp4 file. I did this to save time and convert large files in parallel.

    However, I am stuck because the command that normally runs on command line for ffmpeg, doesn’t run via script.

    I am kind of stuck here and will like to have some assistance.

    #!/bin/bash


    #sleep 5


    filenametmp=$1;

    filename=`echo "$filenametmp" | awk '{split($0,a,"."); print a[1]}'`


    echo $filename

    output="$filename-output"

    filenamewithoutpath=`echo "$output" | awk '{split($0,a,"/"); print a[4]}'`

    echo $output $filenamewithoutpath

    /usr/bin/ffmpeg -i $filenametmp -c copy -map 0 -segment_time $2 -f segment $output%01d.flv

    #sleep 10


    #echo "/bin/ls -lrt /root/storage/ | /bin/grep $filenamewithoutpath | /usr/bin/wc -l"
    filecounttmp=`/bin/ls -lrt /opt/storage/ | /bin/grep $filenamewithoutpath | /usr/bin/wc -l`

    filecount=`expr $filecounttmp - 1`

    echo $filecount

    for i in `seq 0 $filecount`
    do


    suffix=`expr 0000 + $i`

    filenametoconvert="$output$suffix.flv"
    convertedfilename="$output$suffix.mp4"
    echo $filenametoconvert

    /usr/bin/ffmpeg -i $filenametoconvert -c:v libx264 -crf 23 -preset medium -vsync 1 -r 25 -c:a aac -strict -2 -b:a 64k -ar 44100 -ac 1 $convertedfilename > /dev/null 2>&1 &


    done





    sleep 5

    concatstring=""

    for j in `seq 0 $filecount`
    do


    suffix=`expr 0000 + $j`

    convertedfilenamemp4="$output$suffix.mp4"

    #concatstring=`concat:$concatstring|$convertedfilenamemp4`

    echo "file" $convertedfilenamemp4 >> $filename.txt

    #ffmpeg -i concat:"$concatstring" -codec copy $filename.mp4

    #ffmpeg -f concat -i $filename.txt -c copy $filename.mp4


    done

    echo $concatstring

    ffmpeg -f concat -i $filename.txt -c copy $filename.mp4


    rm $output*
    rm $filename.txt

    I run any flv file like this :

    ./ff.sh /opt/storage/tttttssssssssss_573f5b1cd473202daf2bf694.flv 20

    I get this error message :

    moov atom not found

    I am on Ubuntu 14.04 LTS version, standard installation of ffmpeg.

  • Running a py script in the Cloud

    12 January 2018, by Anay Bose

    I’m new to Google’s cloud & Virtual Machine(VM) instances, and I need some clarifications on a couple of points. I have a python script; it imports a long range of functions. I need to run those functions in parallel. I’m using multiprocessing and Process, not threads. These functions are basically image and media processors, and they use many other tools like FFMPEG, imagemagick and Avisynth in addition to a wide range of python modules, including moviepy. Now, I would like to run some 50 functions in parallel assigning a CPU for each process. Images, media and avi files are stored in seperate folders. I’m on Windows7 Core-i7 machine. So, need cloud computing power.

    Now, my question can I run such a python script/app in the cloud that requires a very complicated file system and non-python tools i.e. ffmpeg, avisynth and avi files?

    Can Google VMs emulate my local machine and empower me with more cores and memory to run such a program? if not, then what are my options? Is their any tutorials that I can follow? I need your suggestions. I have given below an example script and some codes to help facilitate your understanding about my situation.

    from __future__ import unicode_literals
    import youtube_dl
    import os
    import time
    import sys
    reload(sys)  
    sys.setdefaultencoding('utf-8')
    from multiprocessing import Process
    from utils import *

    from clip31 import VIDEO31
    from clip32 import VIDEO32
    from clip189 import VIDEO189
    from clip16 import VIDEO16
    from clip39 import VIDEO39


    if __name__== '__main__':

       # 1. CALLING A FUNCTION
       folder = "bodyforce3\\16"
       serial = "16"
       images = get_filepaths("../16")
       videos = get_filepaths("12__media")
       pngs = get_filepaths("../pngs")

       Process(target=VIDEO192, args=(folder, serial, color1, color2, color3, images, videos)).start()


       # 2. CALLING A FUNCTION
       folder = "bodyforce3\\20"
       serial = "20"
       images = get_filepaths("../20")
       videos = get_filepaths("18__media")

       Process(target=VIDEO32, args=(folder, serial, color1, color2, color3, images, videos)).start()


       # 3. CALLING A FUNCTION
       folder = "bodyforce3\\14"
       serial = "14"
       images = get_filepaths("../14")
       videos = get_filepaths("16__media")

       Process(target=VIDEO91, args=(folder, serial, color1, color2, color3, images, videos)).start()

    I copy avi files in functions like this:

    src = "clip50_files"
    src_files = os.listdir(src)
    for file_name in src_files:
       full_file_name = os.path.join(src, file_name)
       if (os.path.isfile(full_file_name)):
           shutil.copy(full_file_name, folder)

    I call ffmpeg commands like this, and they are included within py functions.

    ###########################
    #### FFMPEG OPERATIONS ####
    ###########################

    print "Starting FFMPEG operations ..."

    if os.path.isfile(os.path.join(folder, "bounce-(3).avi")):
       os.remove(os.path.join(folder, "bounce-(3).avi"))


    infile = folder + "/bounce-(3).avs"
    outfile = folder + "/bounce-(3).avi"
    codec = "rawvideo"
    pix_fmt = "bgra"

    try:
       subprocess.call(["ffmpeg",
                        "-i" ,infile,
                        "-c:v" ,codec,
                        "-pix_fmt", pix_fmt,
                        outfile],
                       stdout=open(os.devnull, 'w'),
                       stderr=subprocess.STDOUT)
    except subprocess.CalledProcessError as e:  
       #except subprocess.CalledProcessError as e:
       sys.exit(e.output)
    except OSError as e:
       sys.exit(e.strerror)


    print "FFMPEG operations ended"