Recherche avancée

Médias (3)

Mot : - Tags -/pdf

Autres articles (35)

  • Des sites réalisés avec MediaSPIP

    2 mai 2011, par

    Cette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
    Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page.

  • Gestion générale des documents

    13 mai 2011, par

    MédiaSPIP ne modifie jamais le document original mis en ligne.
    Pour chaque document mis en ligne il effectue deux opérations successives : la création d’une version supplémentaire qui peut être facilement consultée en ligne tout en laissant l’original téléchargeable dans le cas où le document original ne peut être lu dans un navigateur Internet ; la récupération des métadonnées du document original pour illustrer textuellement le fichier ;
    Les tableaux ci-dessous expliquent ce que peut faire MédiaSPIP (...)

  • HTML5 audio and video support

    13 avril 2011, par

    MediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
    The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
    For older browsers the Flowplayer flash fallback is used.
    MediaSPIP allows for media playback on major mobile platforms with the above (...)

Sur d’autres sites (3488)

  • Bash script to automate FFmpeg operations fails when calling the command, but copy-pasting the generated command into the terminal works [duplicate]

    28 février, par GaboScharff99

    I wrote a bash script which automates a number of conversion operations on video files using FFmpeg. Oddly enough, the FFmpeg call itself now fails when running the script, with a very confusing error message, I might add, but when I copy the command generated by the script into the terminal and run it, it works flawlessly. I'm sorry to insert such a long code block here, but considering how strange this error is, it might be anywhere in the script, so here it is :

    


    #!/bin/bash

audioTrack=1
subSource=1
subTrack=0
transcodeVideo=1
transcodeAudio=1
volumeMultiplier=1
degradeToStereo=0
subLanguage="Japanese"

while getopts "t:ns:vam:dl:h" opt; do
    case "$opt" in
        t) audioTrack=${OPTARG};;
        n) subSource=0;;
        s) subTrack=${OPTARG};;
        v) transcodeVideo=0;;
        a) transcodeAudio=0;;
        m) volumeMultiplier=${OPTARG};;
        d) degradeToStereo=1;;
        l) subLanguage=${OPTARG};;
        h)
            echo "Options:"
            echo "-t [integer]: Audio track number. Default: 1."
            echo "-n: If included, subtitles will be taken from internal source."
            echo "-s [integer]: Subtitles track number. Default: 0."
            echo "-v: If included, video source will be copied without transcoding."
            echo "-a: If included, audio source will be copied without transcoding."
            echo "-m [number]: Volume multiplier. If 1, volume is unaffected. Default: 1"
            echo "-d: If included, audio will be degraded to stereo."
            echo "-l [language]: Subtitles language. Only used for external subtitles source. Default: Japanese."
            exit 0
        ;;
    esac
done

echo "Audio track: $audioTrack."
echo "Subtitles track: $subTrack."
params="-map 0:0 -map 0:$audioTrack -map $subSource:$subTrack -c:v"

if [[ $transcodeVideo -eq 1 ]]; then
    echo "Video will be transcoded."
    params="$params hevc"
elif [[ $transcodeVideo -eq 0 ]]; then
    echo "Video will be copied without transcoding."
    params="$params copy"
fi

params="$params -c:a"

if [[ $transcodeAudio -eq 1 ]]; then
    echo "Audio will be transcoded."
    params="$params libopus"
elif [[ $transcodeAudio -eq 0 ]]; then
    echo "Audio will be copied without transcoding."
    params="$params copy"
fi

if [[ $volumeMultiplier -ne 1 ]]; then
    echo "Volume will be multiplied by a factor of $volumeMultiplier."
    params="$params -filter:a 'volume=$volumeMultiplier'"
else
    echo "Volume will be unaffected."
fi

if [[ $degradeToStereo -eq 1 ]]; then
    echo "Audio will be degraded to stereo."
    params="$params -ac 2"
elif [[ $degradeToStereo -eq 0 ]]; then
    echo "Audio will not be degraded to stereo."
fi

params="$params -c:s copy"

if [[ $subSource -eq 1 ]]; then
    echo "Subtitles source is external."
    echo "Subtitles language is $subLanguage."
    params="$params -metadata:s:s:0 title='' -metadata:s:s:0 language='$subLanguage'"
else
    echo "Subtitles source is internal."
fi

if [[ -f titles.txt ]]; then
    echo "A titles.txt file was found. Titles will be changed according to it."
    echo "Please check titles.txt to make sure the titles are correct."
    changeTitles=1
    counter=0
else
    echo "A titles.txt file was not found. Titles will not be changed."
    changeTitles=0
fi

read -p "Are these options correct? (y/n) " choice

case "$choice" in
    y|Y)
        echo "Initiating conversion sequence. This may take a while..."

        mkdir output
        currentParams=""

        shopt -s nullglob
        for i in *.mp4 *.mkv; do
            currentParams=$params
            fileNameNoExtension=$(echo $i | rev | cut -f 2- -d '.' | rev)

            if [[ $subSource -eq 1 ]]; then
                currentParams="-f srt -i $fileNameNoExtension.srt $currentParams"
            fi

            if [[ $changeTitles -eq 1 ]]; then
                ((counter++))
                currentParams="$currentParams -metadata title='$(awk "NR==$counter" titles.txt)'"
            fi

            ffmpeg -i "$i" $currentParams "output/$fileNameNoExtension.mkv"
        done

        echo "Conversion finished!"
    ;;
    n|N) echo "Operation canceled. Exiting.";;
    *) echo "Invalid input. Try again.";;
esac


    


    The directory I'm running this in contains six video files :

    


      

    1. E1 - The Pirates of Orion.mkv
    2. 


    3. E2 - Bem.mkv
    4. 


    5. E3 - The Practical Joker.mkv
    6. 


    7. E4 - Albatross.mkv
    8. 


    9. E5 - How Sharper Than a Serpent's Tooth.mkv
    10. 


    11. E6 - The Counter-Clock Incident.mkv
    12. 


    


    Here's the titles.txt file, for completion's sake :

    


    Star Trek: The Animated Series - Season 2, Episode 1 - The Pirates of Orion
Star Trek: The Animated Series - Season 2, Episode 2 - Bem
Star Trek: The Animated Series - Season 2, Episode 3 - The Practical Joker
Star Trek: The Animated Series - Season 2, Episode 4 - Albatross
Star Trek: The Animated Series - Season 2, Episode 5 - How Sharper Than a Serpent's Tooth
Star Trek: The Animated Series - Season 2, Episode 6 - The Counter-Clock Incident


    


    And finally, here's the error message given by FFmpeg on the terminal for every video file when running the command :

    


    Unable to find a suitable output format for 'Trek:'
Trek:: Invalid argument


    


    Maybe there are better ways to handle all of this, but first and foremost, I would like to figure out why the command fails with such a confusing error message. The only place where the string 'Trek :' is found is in the title taken from titles.txt, but I don't understand why that's seemingly being passed to the name of the output file instead of the title, and apparently only when running the script.

    


    Thanks a lot for your answers ! I know this is quite a bit of text, so I really appreciate you taking your time to read through this.

    


  • PHP and FFmpeg : works on terminal but ffmpeg error when in shell_exec

    25 janvier 2014, par user2128983

    I'm in front of a problem I can't solve !

    I try to convert videos using the ffmpeg tool. When I paste the command on the server terminal (ssh root), it works fine. But, when I try in my PHP script using shell_exec, it returns the error "Error while opening encoder ...".

    Here is the command I use :

    ffmpeg -y -i VIDEOIN.mov -preset medium -strict -2 -c:v libx264 -b:v 1000k -pass 1 -f mp4 VIDEOOUT.mp4 null 1>logfile.txt 2>&1 &

    And my PHP script :

    $dir = 'videos/'.$uuid;
    $out = $dir.'video.mp4';
    $log = $dir.'transcoding_log.txt';
    $preset = 'medium';
    $bitrate = 1000;

    $cmd = "ffmpeg -y -i ".$in." -preset ".$preset." -strict -2 -c:v libx264 -b:v ".$bitrate."k -pass 1 -f mp4 ".$out." null 1>".$log." 2>&1 &";
    @file_put_contents($dir.'cmd.log', $cmd); // to debug
    shell_exec($cmd);

    Here is the log file created in the PHP script :

    ffmpeg version 1.0.8 Copyright (c) 2000-2013 the FFmpeg developers
    built on Sep 12 2013 11:57:09 with gcc 4.7 (Debian 4.7.2-5)
    configuration: --prefix=/usr --extra-cflags='-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security ' --extra-ldflags='-Wl,-z,relro' --cc='ccache cc' --enable-shared --enable-libmp3lame --enable-gpl --enable-nonfree --enable-libvorbis --enable-pthreads --enable-libfaac --enable-libxvid --enable-postproc --enable-x11grab --enable-libgsm --enable-libtheora --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libx264 --enable-libspeex --enable-nonfree --disable-stripping --enable-libvpx --enable-libschroedinger --disable-encoder=libschroedinger --enable-version3 --enable-libopenjpeg --enable-librtmp --enable-avfilter --enable-libfreetype --enable-libvo-aacenc --disable-decoder=amrnb --enable-libvo-amrwbenc --enable-libaacplus --libdir=/usr/lib/x86_64-linux-gnu --disable-vda --enable-libbluray --enable-libcdio --enable-gnutls --enable-frei0r --enable-openssl --enable-libass --enable-libopus --enable-fontconfig --enable-libfdk-aac --enable-libdc1394 --disable-altivec --dis  libavutil      51. 73.101 / 51. 73.101
     libavcodec     54. 59.100 / 54. 59.100
     libavformat    54. 29.104 / 54. 29.104
     libavdevice    54.  2.101 / 54.  2.101
     libavfilter     3. 17.100 /  3. 17.100
     libswscale      2.  1.101 /  2.  1.101
     libswresample   0. 15.100 /  0. 15.100
     libpostproc    52.  0.100 / 52.  0.100
    Input #0, matroska,webm, from 'videos/18352678af96ecb5/origin.webm':
     Metadata:
       creation_time   : 2010-05-20 08:21:12
     Duration: 00:00:32.48, start: 0.000000, bitrate: 533 kb/s
       Stream #0:0(eng): Video: vp8, yuv420p, 640x360, SAR 1:1 DAR 16:9, 25 fps, 25 tbr, 1k tbn, 1k tbc (default)
       Stream #0:1(eng): Audio: vorbis, 44100 Hz, mono, s16 (default)
    [libx264 @ 0x19c05a0] using SAR=1/1
    [libx264 @ 0x19c05a0] using cpu capabilities: MMX2 SSE2Fast SSEMisalign LZCNT
    [libx264 @ 0x19c05a0] ratecontrol_init: can't open stats file
    Output #0, mp4, to 'videos/18352678af96ecb5/video.mp4':
       Stream #0:0(eng): Video: h264, yuv420p, 640x360 [SAR 1:1 DAR 16:9], q=-1--1, pass 1,     90k tbn, 25 tbc (default)
       Stream #0:1(eng): Audio: none, 44100 Hz, mono, s16, 128 kb/s (default)
    Stream mapping:
     Stream #0:0 -> #0:0 (vp8 -> libx264)
     Stream #0:1 -> #0:1 (vorbis -> libfaac)
    Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as     bit_rate, rate, width or height

    EDIT 1 :

    I compiled ffmpeg with the latest revision but the problem still occurs.

  • FFMPEG : Terminal : Output name included original file ending ".mov" in output title : How to remove [duplicate]

    3 mai 2022, par Gio

    I successfully outputted the desired effect for my FFMPEG command. I had been removing the audio from my videos with this line of code :

    


     for i in *.mov; do ffmpeg -i $i -c:v copy -an $i-noaudio.mp4; done


    


    The output results as "myInputvideo.mov-noaudio.mp4"

    


    How might I get this to output without the ".mov" in the title ?
And how might I move all these outputs into a new directory entitled "no-audio"

    


    Thank you !