Recherche avancée

Médias (0)

Mot : - Tags -/configuration

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (25)

  • Supporting all media types

    13 avril 2011, par

    Unlike most software and media-sharing platforms, MediaSPIP aims to manage as many different media types as possible. The following are just a few examples from an ever-expanding list of supported formats : images : png, gif, jpg, bmp and more audio : MP3, Ogg, Wav and more video : AVI, MP4, OGV, mpg, mov, wmv and more text, code and other data : OpenOffice, Microsoft Office (Word, PowerPoint, Excel), web (html, CSS), LaTeX, Google Earth and (...)

  • Monitoring de fermes de MediaSPIP (et de SPIP tant qu’à faire)

    31 mai 2013, par

    Lorsque l’on gère plusieurs (voir plusieurs dizaines) de MediaSPIP sur la même installation, il peut être très pratique d’obtenir d’un coup d’oeil certaines informations.
    Cet article a pour but de documenter les scripts de monitoring Munin développés avec l’aide d’Infini.
    Ces scripts sont installés automatiquement par le script d’installation automatique si une installation de munin est détectée.
    Description des scripts
    Trois scripts Munin ont été développés :
    1. mediaspip_medias
    Un script de (...)

  • Emballe médias : à quoi cela sert ?

    4 février 2011, par

    Ce plugin vise à gérer des sites de mise en ligne de documents de tous types.
    Il crée des "médias", à savoir : un "média" est un article au sens SPIP créé automatiquement lors du téléversement d’un document qu’il soit audio, vidéo, image ou textuel ; un seul document ne peut être lié à un article dit "média" ;

Sur d’autres sites (4786)

  • How to get the video count of youtube_dl (1 of 256) in its output and hide ffmpeg console when converting the format ?

    28 août 2020, par Kristen

    I am creating a GUI program in Qt creator via Pyside2 and it's a program that lets you download Youtube music. My goal is to get the video count like x of 256 or x of 2 or 1 of 256 when downloading the playlist but I don't know how. I've come across two problems.

    


    First problem : I don't know how to get this information from youtube_dl output

    


    [youtube:playlist] Downloading playlist PLi0XaxnSihZSnD1TNm82Y43o92r6UNEfH - add --no-playlist to just download video -5EmnQp3V48
[youtube:playlist] PLi0XaxnSihZSnD1TNm82Y43o92r6UNEfH: Downloading webpage
[download] Downloading playlist: Dance Central Songs
[youtube:playlist] PLi0XaxnSihZSnD1TNm82Y43o92r6UNEfH: Downloading page #1
[youtube:playlist] PLi0XaxnSihZSnD1TNm82Y43o92r6UNEfH: Downloading page #2
[youtube:playlist] playlist Dance Central Songs: Downloading 251 videos
[download] Downloading video **1 of 251**
[youtube] bESGLojNYSo: Downloading webpage
[download] Destination: Lady Gaga - Poker Face (Official Music Video)-bESGLojNYSo.webm
[download] 100% of 3.50MiB in 00:01                   
Finished
[ffmpeg] Destination: Lady Gaga - Poker Face (Official Music Video)-bESGLojNYSo.mp3
Deleting original file Lady Gaga - Poker Face (Official Music Video)-bESGLojNYSo.webm (pass -k to keep)
[download] Downloading video **2 of 251**
[youtube] E2tMV96xULk: Downloading webpage
14:03:36: C:\Python38\python.exe exited with code 0


    


    Second problem : If my program is in .exe format then FFMPEG console appears and disappears immediately after it has completed the conversion but it's taking the user focus every time which gets annoying.

    


    What I've tried for first problem is that I tried to get it manually but it did not work then I checked youtube_dl github download dictionary keys and there is not a key that can acquire that video count 1 of 256

    


    print("Download keys:", download.keys())
Download keys: dict_keys(['status', 'downloaded_bytes', 'total_bytes', 'tmpfilename', 'filename', 'eta', 'speed', 'elapsed', '_eta_str', '_percent_str', '_speed_str', '_total_bytes_str'])


    


    What I've tried for second problem is actually none. I checked C# versions and with C# you can hide that console or disable it but I haven't found a way to do that in Python yet. Goal here is disable ffmpeg console taking either the focus or hide/disable it or third option is to use another converter.

    


    Youtube_dl code that is in Worker thread :

    


    def run(self):
    self.main_window.progressBar.setValue(0)

    self.ydl_opts = {
        'format': 'bestaudio/best',
        'noplaylist': self.main_window.playlist,
        'source_address': '0.0.0.0',
        'ignoreerrors': True,
        'progress_hooks': [self.my_hook],
        'postprocessors': [{
            'key': 'FFmpegExtractAudio',
            'preferredcodec': 'mp3'
        }]
    }

    with youtube_dl.YoutubeDL(self.ydl_opts) as ydl:
        ydl.download([f'{self.main_window.downloadURL.text()}'])

def my_hook(self, download):
    if download["status"] == "finished":
        print("Finished")
        self.main_window.progressText.setText("Ready")
    if download["status"] == "downloading":
        self.updateText.emit("Downloading...")
        percent = download["_percent_str"]
        percent = percent.replace("%", "")
        self.updateProgress.emit(float(percent))


    


    Edit : FFMPEG console appearing and disappearing for a moment is shown in this video here in dropbox :
ffmpeg console appearing and disappearing video

    


  • Mangled output when printing strings from FFProbe STDERR

    9 février 2018, par spikespaz

    I’m trying to make a simple function to wrap around FFProbe, and most of the data can be retrieved correctly.

    The problem is when actually printing the strings to the command line using both Windows Command Prompt and Git Bash for Windows, the output appears mangled and out of order.

    Some songs (specifically the file Imagine Dragons - Hit Parade_ Best of the Dance Music Charts\80 - Beazz - Lime (Extended Mix).flac) are missing metadata. I don’t know why, but the dictionary the function below returns is empty.

    FFProbe outputs its results to stderr which can be piped to subprocess.PIPE, decoded, and parsed. I chose regex for the parsing bit.

    This is a slimmed down version of my code below, for the output take a look at the Github gist.

    #! /usr/bin/env python3
    # -*- coding: utf-8 -*-

    import os

    from glob import glob
    from re import findall, MULTILINE
    from subprocess import Popen, PIPE


    def glob_from(path, ext):
       """Return glob from a directory."""
       working_dir = os.getcwd()
       os.chdir(path)

       file_paths = glob("**/*." + ext)

       os.chdir(working_dir)

       return file_paths


    def media_metadata(file_path):
       """Use FFPROBE to get information about a media file."""
       stderr = Popen(("ffprobe", file_path), shell=True, stderr=PIPE).communicate()[1].decode()

       metadata = {}

       for match in findall(r"(\w+)\s+:\s(.+)$", stderr, MULTILINE):
           metadata[match[0].lower()] = match[1]

       return metadata


    if __name__ == "__main__":
       base = "C:/Users/spike/Music/Deezloader"

       for file in glob_from(base, "flac"):
           meta = media_metadata(os.path.join(base, file))
           title_length = meta.get("title", file) + " - " + meta.get("length", "000")

           print(title_length)

    Output Gist
    Output Raw

    I don’t understand why the output (the strings can be retrieved from the regex pattern effectively, however the output is strangely formatted when printing) appears disordered only when printing to the console using python’s print function. It doesn’t matter how I build the string to print, concatenation, comma-delimited arguments, whatever.

    I end up with the length of the song first, and the song name second but without space between the two. The dash is hanging off the end for some reason. Based on the print statement in the code before, the format should be Title - 000 ({title} - {length}) but the output looks more like 000Title -. Why ?

  • avcodec_open2 : PCM channels out of bounds

    4 février 2018, par bot1131357

    I am trying to read an audio RTP stream in my application, but I am getting this error :

    [pcm_mulaw @ 03390580] PCM channels out of bounds

    I can read the RTP stream fine with ffplay :

    ffplay -i test.sdp -protocol_whitelist file,udp,rtp

    I generate the RTP stream using this command :

    ffmpeg -re -f lavfi -i aevalsrc="sin(400*2*PI*t)" -ar 8000 -f mulaw -f rtp rtp://127.0.0.1:8554

    // SDP
    v=0
    o=- 0 0 IN IP4 127.0.0.1
    s=No Name
    c=IN IP4 127.0.0.1
    t=0 0
    a=tool:libavformat 57.25.101
    m=audio 8554 RTP/AVP 0
    b=AS:64

    And here is my source code :

    #include "stdafx.h"
    #include
    extern "C"
    {
       #include <libavutil></libavutil>opt.h>
       #include <libavcodec></libavcodec>avcodec.h>
       #include <libavutil></libavutil>channel_layout.h>
       #include <libavutil></libavutil>common.h>
       #include <libavutil></libavutil>imgutils.h>
       #include <libavutil></libavutil>mathematics.h>
       #include <libavutil></libavutil>samplefmt.h>
       #include <libavformat></libavformat>avformat.h>
    }

    #define AUDIO_INBUF_SIZE 20480
    #define AUDIO_REFILL_THRESH 4096

    #define ERRBUFFLEN 200
    char errbuf[ERRBUFFLEN];
    #define av_err2str(ret) av_strerror(ret, errbuf, ERRBUFFLEN)

    /*
    * Audio decoding.
    */
    static void audio_decode_example(const char *outfilename, const char *filename)
    {
       AVCodec *inCodec;
       AVCodecContext *inCodecCtx = NULL;
       int len;
       FILE *f, *outfile;
       uint8_t inbuf[AUDIO_INBUF_SIZE + AV_INPUT_BUFFER_PADDING_SIZE];
       AVPacket avpkt;
       AVFrame *decoded_frame = NULL;


       AVFormatContext *inFormatCtx = NULL;
       AVFrame *inFrame = NULL;
       AVFrame *outFrame = NULL;

       int ret;

       av_init_packet(&amp;avpkt);

       AVDictionary *d = NULL;           // "create" an empty dictionary
       int listen = false;
       listen = true;
       if (listen)
       {
           av_dict_set(&amp;d, "protocol_whitelist", "file,udp,rtp", 0); // add an entry
           printf("Listening mode.\n");
       }
       else {
           printf("Connecting mode.\n");
       }

       // Open video file
       ret = avformat_open_input(&amp;inFormatCtx, filename, NULL, &amp;d);
       if (ret &lt;0)
       {
           printf_s("Failed: cannot open input.\n");
           av_strerror(ret, errbuf, ERRBUFFLEN);
           fprintf(stderr, "avformat_open_input() fail: %s\n", errbuf);
           exit(1);
       }

       printf_s("Retrieve stream information.\n");
       ret = avformat_find_stream_info(inFormatCtx, NULL);
       if (ret &lt;0)
       {
           printf_s("Failed: cannot find stream.\n");
           av_strerror(ret, errbuf, ERRBUFFLEN);
           fprintf(stderr, "avformat_find_stream_info() fail: %s\n", errbuf);
           exit(1);
       }

       av_dump_format(inFormatCtx, 0, filename, 0);

       int stream_idx = -1;

       for (int i = 0; i &lt; inFormatCtx->nb_streams; i++)
           if (inFormatCtx->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
               stream_idx = i;
               break;
           }
       if (stream_idx == -1)
       {
           fprintf(stderr, "Video stream not found\n");
           exit(1);
       }

       inCodec = avcodec_find_decoder(inFormatCtx->streams[stream_idx]->codec->codec_id);
       if (!inCodec) {
           fprintf(stderr, "Codec not found\n");
           exit(1);
       }

       inCodecCtx = avcodec_alloc_context3(inCodec);
       if (!inCodecCtx) {
           fprintf(stderr, "Could not allocate audio codec context\n");
           exit(1);
       }
       /* Error here */
       ret = avcodec_open2(inCodecCtx, inCodec, NULL);
       if (ret &lt; 0) {
           fprintf(stderr, "Could not open codec: %s\n", av_err2str(ret));
           exit(1);
       }
       (...more code)

    I know something is wrong, but what is it ? Suggestions and tips are much appreciated.