Recherche avancée

Médias (1)

Mot : - Tags -/Christian Nold

Autres articles (39)

  • Mise à jour de la version 0.1 vers 0.2

    24 juin 2013, par

    Explications des différents changements notables lors du passage de la version 0.1 de MediaSPIP à la version 0.3. Quelles sont les nouveautés
    Au niveau des dépendances logicielles Utilisation des dernières versions de FFMpeg (>= v1.2.1) ; Installation des dépendances pour Smush ; Installation de MediaInfo et FFprobe pour la récupération des métadonnées ; On n’utilise plus ffmpeg2theora ; On n’installe plus flvtool2 au profit de flvtool++ ; On n’installe plus ffmpeg-php qui n’est plus maintenu au (...)

  • Personnaliser en ajoutant son logo, sa bannière ou son image de fond

    5 septembre 2013, par

    Certains 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 ;

  • Les autorisations surchargées par les plugins

    27 avril 2010, par

    Mediaspip core
    autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs

Sur d’autres sites (7820)

  • Converting bat to bash script [on hold]

    15 juillet 2019, par dezxela

    Please help me with coversion this script from here to bash :
    https://stackoverflow.com/a/38291960/11786146

    This part of the code seems to be reconciled in me, but I’m not sure that it’s correct :

    #  path to ffmpeg
    export  ffmpeg='/home/user/bin'
    #  source movies from
    export  movieSource='/mnt/dev1/radio/Masha'
    #  tmp dir
    export  tmpDir='/mnt/dev1/radio/Masha'


    #  setup positon, color, background, font for the text overlays
    #  filterComplex, quotes have to be escaped! -> \"
    #  BITC - Burned In Time Code
    export  filterComplexTimecode='drawtext=fontfile='/usr/share/fonts/truetype/freefont/FreeSerif.ttf': timecode='10\:00\:00\:00': timecode_rate=24: x=(w-tw)/2: y=h-(1*lh)-3: fontsize=20: fontcolor=white@0.4: box=1: boxcolor=0x00000000@0.4: boxborderw=4'
    #  Date
    export  filterComplexDate='drawtext=fontfile='/usr/share/fonts/truetype/freefont/FreeSerif.ttf': text='%{localtime\:%X}': x=(w-tw-3): y=h-(1*lh)-3: fontsize=20: fontcolor=white@0.4: box=1: boxcolor=0x00000000@0.4: boxborderw=4'
    #  Shotname
    export  filterComplexShotname='drawtext=fontfile='/usr/share/fonts/truetype/freefont/FreeSerif.ttf': x=0: y=h-(1*lh)+1: fontsize=20: fontcolor=white@0.4: box=1: boxcolor=0x00000000@0.4: boxborderw=4:'

    #  create a list of all files
    find "$movieSource" -name "*.mp4" -type f | sort -R | while read j; do echo "file '$j'" >> $tmpDir/filelist.txt; done

    echo filename, durationInSeconds > $tmpDir/fileNameDuration.txt
    for file in $movieSource/*.mp4; do
     #  Reset current duration to 0 (zero) for each loop
     export  curDuration=0
     #  get the filename without file extenion
     export  fileName=${file##*/}
     #  get the duration of a single clip
     #  and write it to a tmp textfile
     $ffmpeg/ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 "$file" > $tmpDir/fileTempDuration.txt
     #  read the textfile again into a variable
    read -p  < $tmpDir/fileTempDuration.txt last curDuration

     #  write the filename and the duration to a new list of all files
    echo $fileName,$curDuration >> $tmpDir/fileNameDuration.txt ;done

    #  concate a filter complex string for ffmpeg with all clipnames as textlayer with a inpoint and outpoint
    export  filterComplexShotnameCombined=
    #  floating numbers are not supported by batch, so we need to work-around that
    source  :IntAsFP b=0.000000
    for i in $tmpDir/fileNameDuration.txt; do
     source  :IntAsFP a=$j
     source  :IntToFP inPoint=$b 6
     export  c=$(expr a + b)
     export   b=c
     source  :IntToFP outPoint=$c 6
     #  just to check whats going on...
     echo name: $i   duration: $j   inPoint: $inPoint   outPoint: $outPoint
     export  filterComplexShotnameCombined='$filterComplexShotnameCombined, $filterComplexShotname text=$i: enable=between(t\,$inPoint\,$outPoint^^^)';done
  • when ffpmeg drops frames some things aren't played back in real time

    8 février 2024, par Alex028502

    I am trying to run a bunch of ffpmeg processes that act as simulators for cameras, and something funny is happening when I the processor can't keep up with the configured frame rate.

    


    I have replaced the rtsp stream with an output file, and managed to reproduce the issue, so will just show that to keep it simple.

    


    First here is a makefile that creates my source movie :

    


    clock.mp4: Makefile
    rm -f $@
    ffmpeg -f lavfi -i color=c=black:s=4096x2160:r=25 -vf \
"drawtext=fontfile=/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf:fontsize=72:fontcolor=white:x=(w-text_w)/2:y=(h-text_h)/2: \
text='%{eif\:trunc(n/25)\:d}':start_number=0:rate=25" \
-t 60 -r 25 $@


    


    that gives me a one minute long movie that prints the second number to the screen. I have tested it out and the seconds are close enough. I put a lot of pixels to make it easier to jam up my CPU.

    


    Here is the script that creates a processes similar to the one I am trying to debug (called experiment.sh)

    


    I am actually using H.264, but H.265 is easier to overwhelm the processor with

    


    #! /usr/bin/env bash

set -e

echo starting > message$1.txt

rm -f superclock$1.mp4
ffmpeg -re -stream_loop -1 -i clock.mp4 \
       -an -vcodec libx265 -preset ultrafast -sc_threshold -1 -x265-params repeat-headers=1 \
       -vf "drawtext=fontfile=/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf:fontsize=24:fontcolor=white:x=10:y=10:text='%{localtime\:%X}', \
            drawtext=fontfile=/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf:fontsize=24:fontcolor=white:x=10:y=(h-text_h-10):textfile=message$1.txt:reload=1, \
            scale=1920x1080,fps=25" \
       -b:v 3M -minrate 3M -maxrate 3M \
       -bufsize 6M -g 25 superclock$1.mp4 &
pid=$!

for x in $(seq 0 10)
do
    echo $x > message$1.txt
    sleep 10
done

kill -INT $pid || true


    


    It should

    


      

    • put the second in the middle of the screen - 'cause it gets it from the source video
    • 


    • put the approximate sixth of minute in the lower left corner
(only approximate because of the sleep but close enough)
    • 


    • put the the wall clock time in the upper left corner
    • 


    


    and it works

    


    make clock.mpg
./experiment.sh 0
vlc superclock0.mp4


    


    shows something like this
working video

    


    Now here is the interesting part

    


    If I run the script in four different terminals at the same time

    


    ./experiment.sh 1
./experiment.sh 2
./experiment.sh 3
./experiment.sh 4


    


    It can't keep up with the frame rate, and I see this in the output :

    


    frame= 1515 fps= 16 q=0.0 size=     768kB time=00:00:59.96 bitrate= 104.9k


    


    I was hoping the end result would all look ok when I watch it except with fewer frames, but the timestamps of the frames would make it all work as expected

    


    However...

    


      

    • The time in the middle, that is inherited from the source video, the seconds in the middle of the screen, stays in sync with VLC's clock.
    • 


    • the wall clock in the upper left seems play at 150% speed
    • 


    • the every ten seconds incrementor in the lower left seems to increment every 7 seconds
    • 


    • the video is only 1:25 long even though it was recording for at least 1:40 according to sleeps
    • 


    • the wall clock in the upper right hand corner makes it more than 1'40" and then counter in the lower left makes it to 10.
    • 


    


    30 seconds in

    


    Here are four states to compare

    


    |                  | Start    | 30" in   | end      |
|------------------+----------+----------|----------|
| Video Time       | 00:00    | 00:30    | 01:24    |
| Wall Clock Time  | 15:05:50 | 15:06:39 | 15:07:39 |
| sixth of minute  | 0        | 4        | 10       |
| seconds counter  | 0        | 30       | 24       |


    


    end of the movie

    


    So you can see the vlc clock keeps pace with the original clock from the source movie.. even when it is only able to produce frames at 2/3 of the rate. However, the it is taking 50% long to get through the whole source movie I guess ?

    


    I am having trouble coming up with a theory that can explain exactly how this happens.

    


    Does anybody know how I can "correct" this ? (make it so that the movie is played at the same rate that it is recorded)

    


    I am thinking of using a lower frame rate and size as the input video.. but it would be nice to have something that will always work as expected, just with a lower frame rate, no matter how busy the processor is.

    


  • shell script : ffmpeg can't either read arguments or filenames, if spaces in path- or filename

    9 juillet 2014, par Nicolas

    I’m currently working on a bash shell script on OS X to get a custom tailored Pashua GUI/automatization package, using ffmpeg in the back, to transcode videos, label them, zip them, upload them, organize them and so on. Everything is working like a charm so far.

    My problem now is that I can’t make ffmpeg take files or paths that have spaces in them IF I use variables in variables. But that (I think) is a must in order to get ffmpeg to transcode multiple files at once depending on the formats and checkboxes the user ticks on.

    I made a little example snippet so you can see my dilemma.

    No spaces in path or filename / works great :

    #!/bin/bash

    infile='/Users/nicolas/Desktop/MASTER_[DE]_Test_140626.mov'

    gen_outfile () {
       outfile="${1/MASTER/TRANSCODE}"
       ffmpeg_cl="-s $2 -c:v libx264 -preset slow -crf 18 -pix_fmt yuv420p -c:a aac -b:a 240k -strict -2 $outfile"
    }

    gen_outfile "$infile" 1920x1080

    ./ffmpeg_stat -i "$infile" $ffmpeg_cl

    The output is as expected and the file is called "TRANSCODE_[DE]_Test_140626.mov"

    Filename variable with spaces - directly fed to ffmpeg :

    This works as well but isn’t really usable for me because I need to have the option of variable numbers of output files and arguments generated dynamically.

    #!/bin/bash

    infile_full='/Users/nicolas/Google Drive/encode-o-mat/MASTER_[DE] Test  140626.mov'

    gen_outfile () {
       outfile="${1/MASTER/TRANSCODE}"
       ffmpeg_cl="-s $2 -c:v libx264 -preset slow -crf 18 -pix_fmt yuv420p -c:a aac -b:a 240k -strict -2"
    }

    gen_outfile "$infile_full" 1920x1080

    ./ffmpeg_stat -i "$infile_full" $ffmpeg_cl "$outfile"

    The output is as expected and the file is called "TRANSCODE_[DE] Test 140626.mov".
    But this way is just not an option.

    This here does not work ! Filename is split up and incomplete :

    #!/bin/bash

    infile_full='/Users/nicolas/Google Drive/encode-o-mat/MASTER_[DE] Test  140626.mov'

    gen_outfile () {
       outfile="${1/MASTER/TRANSCODE}"
       ffmpeg_cl="-s $2 -c:v libx264 -preset slow -crf 18 -pix_fmt yuv420p -c:a aac -b:a 240k -strict -2 $outfile"
    }

    gen_outfile "$infile_full" 1920x1080

    ./ffmpeg_stat -i "$infile_full" $ffmpeg_cl

    Ffmpeg gives this error : "Unable to find a suitable output format for ’/Users/nicolas/Google’".
    Of course.

    This doesn’t work as well ! Quoting and such :

    ./ffmpeg_stat -i "$infile_full" "$ffmpeg_cl"

    If I put the $ffmpeg_cl variable in various quotes ffmpeg doesn’t understand the arguments anymore ! This is one example output :

    "Unrecognized option ’s 1920x1080 -c:v libx264 -preset slow -crf 18 -pix_fmt yuv420p -c:a aac -b:a 240k -strict -2 /Users/nicolas/Google Drive/encode-o-mat/TRANSCODE_[DE] Test 140626.mov’.
    Error splitting the argument list : Option not found
    Conversion failed !"

    It’s really important that the script can handle path- and filenames with spaces because I can’t change the environment in which that tool is supposed to run. All ideas and solutions are more than welcome !