Recherche avancée

Médias (91)

Autres articles (61)

  • La sauvegarde automatique de canaux SPIP

    1er avril 2010, par

    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 avril 2011, par

    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 (...)

  • Installation en mode ferme

    4 février 2011, par

    Le mode ferme permet d’héberger plusieurs sites de type MediaSPIP en n’installant qu’une seule fois son noyau fonctionnel.
    C’est la méthode que nous utilisons sur cette même plateforme.
    L’utilisation en mode ferme nécessite de connaïtre un peu le mécanisme de SPIP contrairement à la version standalone qui ne nécessite pas réellement de connaissances spécifique puisque l’espace privé habituel de SPIP n’est plus utilisé.
    Dans un premier temps, vous devez avoir installé les mêmes fichiers que l’installation (...)

Sur d’autres sites (5128)

  • Images and audio to slideshow movie

    16 juin 2015, par Terji Petersen

    I’m trying to get FFmpeg to generate a slide show mp4 movie using an mp3 audio track and several jpg images. Having trouble getting the length of the movie to match the length of the mp3 file and the images evenly spaced.
    Following is the closest I’ve gotten :

    ffmpeg -framerate 1/5 -i img%02d.jpg -i input.mp3 -c:v libx264 -r 30
    -shortest -t 19 output.mp4

    The output here is a 15 second movie, 5 seconds per image but the mp3 file is 19 seconds long.

    Any ideas ?

  • Can I know which byte range to read from a remote mp4 file for FFMpeg to decode a keyframe ?

    12 octobre 2023, par db9117

    I need to decode a of keyframe of a video file (mp4, h264 encoded). I know the timestamp of the keyframe I want to extract/decode. I want to minimize amount of data being read in memory. For this, I need to know beforehand exactly the minimal byte range I would require that encompasses this keyframe. How do I know what is the minimal byte range in the whole mp4 byte stream I need to read in order to be able to decode the keyframe ?

    


    I currently find the appropriate keyframe in the index_entries contained in the header. I get its byte position (pos attribute) and timestamp (timestamp attribute). I calculate the range as follows :

    


    startBytes : minimum of :

    


      

    1. the pos of the keyframe
    2. 


    3. the pos of the nearest index entry in the audio stream happening at or before the keyframe's timestamp.
    4. 


    


    This way when it's decoding the frame, if it also needs the audio content for demuxing, it would have it.

    


    endBytes : maximum of :

    


      

    1. the pos of the next frame in the video stream's index, after the keyframe
    2. 


    3. the pos of the next frame in the audio stream's index after the timestamp of the wished keyframe.
    4. 


    


    This way I know that I have everything up until the next frame in the index, which theoretically should be enough to decode the keyframe only.

    


    I then read the appropriate byte range.

    


    When I try to decode the frame, I run in a loop until I succeed :

    


      

    • avcodec_read_frame
    • 


    • avcodec_send_packet
    • 


    • avcodec_receive_frame
    • 


    


    I ignore AVERROR(EAGAIN) errors.

    


    avcodec_receive_frame fails multiple times with error AVERROR(EAGAIN) which I ignore, until it fails saying that the memory it wants to read isn't available (wants to read after endBytes). I explicitly tell it to fail if it wants to read more than it has already read.

    


    Note : for other keyframes at other positions in other videos, it sometimes succeeds (probably because the range is big enough by chance), but it fails more often than not.

    


    My question is : Why is the end of the range not enough to be able to decode only the one keyframe ? Is there any way to more precisely calculate the exact range in bytes I would need in order to decode a particular keyframe ?

    


  • How to save variables at start of script for use later if script needs to be re-run due to errors or bad user input

    28 novembre 2023, par slyfox1186

    I have a script that uses GitHub's API to get the latest version number of the repositories that I am trying to download and then compile.

    


    Due to the fact that without using a specialized token from GitHub you are only allowed 50 API calls a day vs the 5000 a day with the API user token.

    


    I want to be able to parse all of the repositories and grab the version numbers that my script will then import into the code up front so in case someone who accidentally cancels the build in the middle of it (for who knows what reasons) wont have to eat up their 50 day API call allowance.

    


    Essentially, store each repo's version number, if the user then needs to rerun the script and version numbers that have been saved so far will be skipped (thus eliminating an API call) and any numbers that are still needing to be sourced will be called and then stored for used in the script.

    


    I am kinda of lost for a method on how to go about this.

    


    Maybe some sort of external file can be generated ?

    


    So what my script does is it builds FFmpeg from source code and all of the external libraries that you can link to it are also built from their latest source code.

    


    The code calls the function git_ver_fn and passes arguments to it which are parsed inside the function and directed to another functions git_1_fn or git_2_fn which passed those parsed arguments that have been passed on to the CURL command which changes the URL based on the arguments passed. It uses the jq command to capture the GitHub version number and download link for the tar.gz file.

    


    It is the version number I am and trying to figure out the best way to store in case the script fails and has to be rerun, which will eat up all of the 50 APT limit that GitHub imposes without a token. I can't post my token in the script because GitHub deactivates it and thus the users will be SOL if they need to run the script more than once.

    


    curl_timeout='5'

git_1_fn()
{
    # SCRAPE GITHUB WEBSITE FOR LATEST REPO VERSION
    github_repo="$1"
    github_url="$2"

    if curl_cmd="$(curl -m "$curl_timeout" -sSL "https://api.github.com/repos/$github_repo/$github_url")"; then
        g_ver="$(echo "$curl_cmd" | jq -r '.[0].name')"
        g_ver="${g_ver#v}"
        g_ssl="$(echo "$curl_cmd" | jq -r '.[0].name')"
        g_ssl="${g_ssl#OpenSSL }"
        g_pkg="$(echo "$curl_cmd" | jq -r '.[0].name')"
        g_pkg="${g_pkg#pkg-config-}"
        g_url="$(echo "$curl_cmd" | jq -r '.[0].tarball_url')"
    fi
}

git_2_fn()
{
    videolan_repo="$1"
    videolan_url="$2"
    if curl_cmd="$(curl -m "$curl_timeout" -sSL "https://code.videolan.org/api/v4/projects/$videolan_repo/repository/$videolan_url")"; then
        g_ver="$(echo "$curl_cmd" | jq -r '.[0].commit.id')"
        g_sver="$(echo "$curl_cmd" | jq -r '.[0].commit.short_id')"
        g_ver1="$(echo "$curl_cmd" | jq -r '.[0].name')"
        g_ver1="${g_ver1#v}"
    fi
}

git_ver_fn()
{
    local v_flag v_tag url_tag

    v_url="$1"
    v_tag="$2"

    if [ -n "$3" ]; then v_flag="$3"; fi

    if [ "$v_flag" = 'B' ] && [  "$v_tag" = '2' ]; then
        url_tag='git_2_fn' gv_url='branches'
    fi

    if [ "$v_flag" = 'X' ] && [  "$v_tag" = '5' ]; then
        url_tag='git_5_fn'
    fi

    if [ "$v_flag" = 'T' ] && [  "$v_tag" = '1' ]; then
        url_tag='git_1_fn' gv_url='tags'
    elif [ "$v_flag" = 'T' ] && [  "$v_tag" = '2' ]; then
        url_tag='git_2_fn' gv_url='tags'
    fi

    if [ "$v_flag" = 'R' ] && [  "$v_tag" = '1' ]; then
        url_tag='git_1_fn'; gv_url='releases'
    elif [ "$v_flag" = 'R' ] && [  "$v_tag" = '2' ]; then
        url_tag='git_2_fn'; gv_url='releases'
    fi

    case "$v_tag" in
        2)          url_tag='git_2_fn';;
    esac

    "$url_tag" "$v_url" "$gv_url" 2>/dev/null
}

# begin source code building
git_ver_fn 'freedesktop/pkg-config' '1' 'T'
if build 'pkg-config' "$g_pkg"; then
    download "https://pkgconfig.freedesktop.org/releases/$g_ver.tar.gz" "$g_ver.tar.gz"
    execute ./configure --silent --prefix="$workspace" --with-pc-path="$workspace"/lib/pkgconfig/ --with-internal-glib
    execute make -j "$cpu_threads"
    execute make install
    build_done 'pkg-config' "$g_pkg"
fi

git_ver_fn 'yasm/yasm' '1' 'T'
if build 'yasm' "$g_ver"; then
    download "https://github.com/yasm/yasm/releases/download/v$g_ver/yasm-$g_ver.tar.gz" "yasm-$g_ver.tar.gz"
    execute ./configure --prefix="$workspace"
    execute make -j "$cpu_threads"
    execute make install
    build_done 'yasm' "$g_ver"
fi