Recherche avancée

Médias (91)

Autres articles (49)

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

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

  • Les vidéos

    21 avril 2011, par

    Comme les documents de type "audio", Mediaspip affiche dans la mesure du possible les vidéos grâce à la balise html5 .
    Un des inconvénients de cette balise est qu’elle n’est pas reconnue correctement par certains navigateurs (Internet Explorer pour ne pas le nommer) et que chaque navigateur ne gère en natif que certains formats de vidéos.
    Son avantage principal quant à lui est de bénéficier de la prise en charge native de vidéos dans les navigateur et donc de se passer de l’utilisation de Flash et (...)

Sur d’autres sites (5096)

  • subprocess call of ffmpeg returns negative value

    11 juin 2019, par Zak44

    Here is the original command line call that works at shell :

    ffmpeg -i /Users/abc/Desktop/Test/Full_Mov.mov -vf "drawtext=fontfile=/System/Library/Fonts/Keyboard.ttf: text='SCENE BLAH BLAH - %{frame_num}': start_number=1: x=(w-tw)/2: y=h-(2*lh): fontcolor=white: fontsize=20: box=1: boxcolor=black: boxborderw=5","format=yuv420p" -f segment -segment_frames 123 -reset_timestamps 1 -c:a copy -map 0 "/Users/abc/Desktop/Test/%03d_test40.mov"

    Getting a negative value when trying to run ffmpeg via subprocess, causing it to fail and not process. I’ve even tried dumbing down the call to just run ffmpeg by itself with no arguments, and it still returns a negative value.

    import subprocess
    ffmpeg = "/usr/local/bin/ffmpeg"
    source = "/Users/abc/Desktop/Test/Full_Mov.mov"
    destination = "/Users/abc/Desktop/Test/%03d_test40.mov"
    cmd = "%s -i %s -vf \"drawtext=fontfile=/System/Library/Fonts/Keyboard.ttf: text='SCENE BLAH BLAH - %%{frame_num}': start_number=1: x=(w-tw)/2: y=h-(2*lh): fontcolor=black: fontsize=20: box=1: boxcolor=white: boxborderw=5\",\"format=yuv420p\" -f segment -segment_frames 123 -reset_timestamps 1 -c:a copy -map 0 \"%s\"" % (ffmpeg, source, destination)
    log("ffmpeg cmd: %s" % cmd)
    log(subprocess.check_output(cmd, shell=True))

    When running full command :

    CalledProcessError: Command '/usr/local/bin/ffmpeg -i /Users/abc/Desktop/Full_Mov.mov -vf "drawtext=fontfile=/System/Library/Fonts/Keyboard.ttf: text='SCENE BLAH BLAH - %{frame_num}': start_number=1: x=(w-tw)/2: y=h-(2*lh): fontcolor=black: fontsize=20: box=1: boxcolor=white: boxborderw=5","format=yuv420p" -f segment -segment_frames 318 -reset_timestamps 1 -c:a copy -map 0 "/Users/abc/Desktop/Test/%03d.tmp.mov"' returned non-zero exit status -8
       raise CalledProcessError(retcode, cmd, output=output)

    When running just ffmpeg no arguments :

    CalledProcessError: Command '/usr/local/bin/ffmpeg' returned non-zero exit status 1
       raise CalledProcessError(retcode, cmd, output=output)

    Latest output with suggested changes below :

    subprocess.CalledProcessError: Command '['/usr/local/bin/ffmpeg', '-i', '/Users/szaharak/Desktop/Flix_Test/ep888_sq66_main_mov_2019_05_20_14_15.mov', '-vf', 'drawtext=fontfile=/System/Library/Fonts/Keyboard.ttf:', 'text=SCENE BLAH BLAH - %%{frame_num}:', 'start_number=1:', 'x=(w-tw)/2:', 'y=h-(2*lh):', 'fontcolor=black:', 'fontsize=20:', 'box=1:', 'boxcolor=white:', 'boxborderw=5', 'format=yuv420p', '-f', 'segment', '-segment_frames', '123', '-reset_timestamps', '1', '-c:a', 'copy', '-map', '0', '/Users/szaharak/Desktop/Flix_Test/%03d_test40.mov']' returned non-zero exit status 1

    [NULL @ 0x7f88c3012200] Unable to find a suitable output format for 'text=SCENE BLAH BLAH - %%{frame_num}:'
    text=SCENE BLAH BLAH - %%{frame_num}:: Invalid argument

    And here is latest...

       >>> rc = subprocess.check_call(cmd)
    ffmpeg version N-93891-ge1839283bc-tessus  https://evermeet.cx/ffmpeg/  Copyright (c) 2000-2019 the FFmpeg developers
     built with Apple LLVM version 10.0.1 (clang-1001.0.46.4)
     configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libmysofa --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-version3 --pkg-config-flags=--static --disable-ffplay

     libavutil      56. 28.100 / 56. 28.100
     libavcodec     58. 52.102 / 58. 52.102
     libavformat    58. 27.103 / 58. 27.103
     libavdevice    58.  7.100 / 58.  7.100
     libavfilter     7. 53.101 /  7. 53.101
     libswscale      5.  4.101 /  5.  4.101
     libswresample   3.  4.100 /  3.  4.100
     libpostproc    55.  4.100 / 55.  4.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Users/szaharak/Desktop/Flix_Test/ep888_sq66_main_mov_2019_05_20_14_15.mov':
     Metadata:
       major_brand     : qt  
       minor_version   : 537199360
       compatible_brands: qt  
       creation_time   : 2019-05-14T17:58:24.000000Z
       com.apple.quicktime.player.movie.audio.gain: 1.000000
       com.apple.quicktime.player.movie.audio.treble: 0.000000
       com.apple.quicktime.player.movie.audio.bass: 0.000000
       com.apple.quicktime.player.movie.audio.balance: 0.000000
       com.apple.quicktime.player.movie.audio.pitchshift: 0.000000
       com.apple.quicktime.player.movie.audio.mute:
       com.apple.quicktime.player.movie.visual.brightness: 0.000000
       com.apple.quicktime.player.movie.visual.color: 1.000000
       com.apple.quicktime.player.movie.visual.tint: 0.000000
       com.apple.quicktime.player.movie.visual.contrast: 1.000000
       com.apple.quicktime.player.version: 7.6.6 (7.6.6)
       com.apple.quicktime.version: 7.7.3 (2943.14) 0x7738000 (Mac OS X, 10.11.6, 15G22010)
     Duration: 00:01:12.67, start: 0.000000, bitrate: 23379 kb/s
       Stream #0:0(eng): Video: mjpeg (Baseline) (jpeg / 0x6765706A), yuvj422p(pc, bt470bg/unknown/unknown), 1280x720 [SAR 72:72 DAR 16:9], 21838 kb/s, 24 fps, 24 tbr, 24k tbn, 24k tbc (default)
       Metadata:
         creation_time   : 2019-05-14T17:58:24.000000Z
         handler_name    : Apple Video Media Handler
         encoder         : Photo - JPEG
       Stream #0:1(eng): Audio: pcm_s16be (twos / 0x736F7774), 48000 Hz, stereo, s16, 1536 kb/s (default)
       Metadata:
         creation_time   : 2019-05-14T17:58:24.000000Z
         handler_name    : Apple Sound Media Handler
    [NULL @ 0x7f8ddc8ce200] Unable to find a suitable output format for 'text=SCENE BLAH BLAH - %{frame_num}: start_number=1: x=(w-tw)/2: y=h-(2*lh): fontcolor=black: fontsize=20: box=1: boxcolor=white: boxborderw=5: format=yuv420p'
    text=SCENE BLAH BLAH - %{frame_num}: start_number=1: x=(w-tw)/2: y=h-(2*lh): fontcolor=black: fontsize=20: box=1: boxcolor=white: boxborderw=5: format=yuv420p: Invalid argument
    Traceback (most recent call last):
     File "<stdin>", line 1, in <module>
     File "/usr/local/Cellar/python@2/2.7.15_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 190, in check_call
       raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['/usr/local/bin/ffmpeg', '-i', '/Users/szaharak/Desktop/Flix_Test/ep888_sq66_main_mov_2019_05_20_14_15.mov', '-vf', 'drawtext=fontfile=/System/Library/Fonts/Keyboard.ttf:', 'text=SCENE BLAH BLAH - %{frame_num}: start_number=1: x=(w-tw)/2: y=h-(2*lh): fontcolor=black: fontsize=20: box=1: boxcolor=white: boxborderw=5: format=yuv420p', '-f', 'segment', '-segment_frames', '123', '-reset_timestamps', '1', '-c:a', 'copy', '-map', '0', '/Users/szaharak/Desktop/Flix_Test/%03d_test40.mov']' returned non-zero exit status 1
    </module></stdin>
  • os.walk returns file names but when trying to modify the files it says directory not found

    13 avril 2021, par epWILL

    Im trying to walk through music folder and find all sub folders in it and convert the mp4's in all folders to wav. It prints out the correct file name but when it trys to convert it says directory not found.

    &#xA;

    I would like to us os.walk to go through all folders instead going through 1 folder and changing the name in the code for the other folders

    &#xA;

    This code works for one folder

    &#xA;

    import os&#xA;import ffmpeg&#xA;import time&#xA;&#xA;path = &#x27;./musicTest/&#x27;&#xA;&#xA;&#xA;os.chdir(path)&#xA;aud_files = os.listdir()&#xA;count = 0&#xA;count2 = 0&#xA;&#xA;&#xA;    ##convert mp4 to wav&#xA;for file in aud_files:&#xA;    os.system(&#x27;ffmpeg -i "{}" -acodec pcm_s16le -ac 1 -ar 16000 output-{}.wav&#x27;.format(file, count))&#xA;    count = count &#x2B; 1&#xA;    os.remove(file)&#xA;

    &#xA;

    this is the code that gives me no directory found when using os.walk but it prints the file name

    &#xA;

    import os&#xA;from pydub import AudioSegment&#xA;import ffmpeg&#xA;&#xA;path = "./musicTest/"&#xA;count = 0&#xA;&#xA;for i, (root, dirs, files) in enumerate(os.walk(path)):&#xA;   if root is not path:&#xA;      for file in files:&#xA;           print(file)&#xA;           os.system(&#x27;ffmpeg -i "{}" -acodec pcm_s16le -ac 1 -ar 16000 output-{}.wav&#x27;.format(file, count))&#xA;           count = count &#x2B; 1&#xA;

    &#xA;

  • Reading RTMP streams using FFMPEG returns AVERROR_EOF randomly

    9 octobre 2013, par user2628781

    I am using FFMpeg to receive RTMP streams. This logic is placed in a custom video player I am building.

    I managed to successfully connect to the RTMP stream and display the video correctly. However, after a period in time, the stream terminates prematurely with an AVERROR_EOF when I perform av_read_frame().

    This indicates to me that the file has ended so my demux, video and audio threads terminates thinking that the video has ended.
    However, the video playback hasn't yet reached its end (in the case of a file streamed through rtmp) or from a live stream (which runs forever). The EOFs are received very randomly so it may run for say 7 min before this occurs or after 3 mins.

    Is this a characteristic behaviour of RTMP or am I doing something incorrectly ?
    I am also having a similar problem with Http Live Streams using FFMpeg.

    A small snippet of the code is provided below :

    AVPacket packet;
    //start timeout timer and timeout
    __interrupt_timer.start();

    int ret = av_read_frame(format_context, &amp;packet); //0: ok, &lt;0: error/end


    //invalidate the timer
    __interrupt_timer.invalidate();

    if (ret != 0) {
       if (ret == AVERROR_EOF) { //end of file. FIXME: why no eof if replaying by seek(0)?            
           if (!eof) {
               eof = true;
               started_ = false;
               pkt->data = QByteArray(); //flush
               pkt->markEnd();
               qDebug("End of file. %s %d", __FUNCTION__, __LINE__);
               emit finished();
               return true;
           }
           pkt->data = QByteArray(); //flush
           //return true;
           return false; //frames after eof are eof frames
       } else if (ret == AVERROR_INVALIDDATA) {
           qWarning("AVERROR_INVALIDDATA");
       } else if (ret == AVERROR(EAGAIN)) {
           return true;
       }
       qWarning("[AVDemuxer] error: %s", av_err2str(ret));
       return false;
    }