Recherche avancée

Médias (0)

Mot : - Tags -/tags

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

Autres articles (10)

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

  • Ajouter notes et légendes aux images

    7 février 2011, par

    Pour pouvoir ajouter notes et légendes aux images, la première étape est d’installer le plugin "Légendes".
    Une fois le plugin activé, vous pouvez le configurer dans l’espace de configuration afin de modifier les droits de création / modification et de suppression des notes. Par défaut seuls les administrateurs du site peuvent ajouter des notes aux images.
    Modification lors de l’ajout d’un média
    Lors de l’ajout d’un média de type "image" un nouveau bouton apparait au dessus de la prévisualisation (...)

  • Keeping control of your media in your hands

    13 avril 2011, par

    The vocabulary used on this site and around MediaSPIP in general, aims to avoid reference to Web 2.0 and the companies that profit from media-sharing.
    While using MediaSPIP, you are invited to avoid using words like "Brand", "Cloud" and "Market".
    MediaSPIP is designed to facilitate the sharing of creative media online, while allowing authors to retain complete control of their work.
    MediaSPIP aims to be accessible to as many people as possible and development is based on expanding the (...)

Sur d’autres sites (4434)

  • Is there a way to use youtube-dl in async

    8 octobre 2024, par Stam Kaly

    I have an application where I use zmq with asyncio to communicate with the clients who have the ability to download a video with youtube-dl to the server. I tried adding await to youtube_dl's download function but it gave me an error since it was not a coroutine. My code right now is simply looking like this :

    



    import asyncio
import youtube_dl


async def networking_stuff():
    download = True
    while True:
        if download:
            print("Received a request for download")
            await youtube_to_mp3("https://www.youtube.com/watch?v=u9WgtlgGAgs")
            download = False
        print("Working..")
        await asyncio.sleep(2)


async def youtube_to_mp3(url):
    ydl_opts = {
        'format': 'bestaudio/best',
        'postprocessors': [{
            'key': 'FFmpegExtractAudio',
            'preferredcodec': 'mp3',
            'preferredquality': '192',
        }]
    }

    with youtube_dl.YoutubeDL(ydl_opts) as ydl:
        ydl.download([url])


loop = asyncio.get_event_loop()
loop.create_task(networking_stuff())
loop.run_forever()


    



    which gives the following output :

    



    Received a request for download
[youtube] u9WgtlgGAgs: Downloading webpage
[youtube] u9WgtlgGAgs: Downloading video info webpage
[youtube] u9WgtlgGAgs: Extracting video information
[youtube] u9WgtlgGAgs: Downloading MPD manifest
[download] Destination: The Cardigans - My Favourite Game “Stone Version”-u9WgtlgGAgs.webm
[download] 100% of 4.20MiB in 00:03
[ffmpeg] Destination: The Cardigans - My Favourite Game “Stone Version”-u9WgtlgGAgs.mp3
Deleting original file The Cardigans - My Favourite Game “Stone Version”-u9WgtlgGAgs.webm (pass -k to keep)
Working..
Working..
....
Working..
Working..


    



    whereas I would expect the Working.. message to be printed in between youtube-dl's messages as well. Am I missing something here or is this impossible with async/await ? Is ffmpeg blocking ? If so, can I run the download in async without converting to mp3 or is using threads the only way ?

    


  • FFmpeg generic error in an external library

    13 octobre 2017, par Mher Didaryan

    I’m trying to encode the game play from Unreal Engine with h264_nvenc encoder on a windows with FFmpeg 3.3.3. FFmpeg was configured with —enable-cuda —enable-cuvid —enable-nvenc
    However avcodec_open2 can’t open the codec.

    Below is the function where call to avcodec_alloc_context3 is.

    void Encoder::AddStream(AVCodecID CodecID)
    {

    VideoCodec = avcodec_find_encoder(CodecID);
    if (!VideoCodec) {
       UE_LOG(LogTemp, Error, TEXT("Could not find encoder for '%s'"), ANSI_TO_TCHAR(avcodec_get_name(CodecID)));
    }

    VideoSt.Stream = avformat_new_stream(FmtCtx, nullptr);
    if (!VideoSt.Stream) {
       UE_LOG(LogTemp, Error, TEXT("Could not allocate stream"));
    }

    VideoSt.Stream->id = FmtCtx->nb_streams - 1;
    VideoSt.Ctx = avcodec_alloc_context3(VideoCodec);
    if (!VideoSt.Ctx) {
       UE_LOG(LogTemp, Error, TEXT("Could not alloc an encoding context"));
    }

    VideoSt.Ctx->codec_id = CodecID;
    VideoSt.Ctx->flags = 0;
    VideoSt.Ctx->me_range = 16;
    VideoSt.Ctx->max_qdiff = 4;
    VideoSt.Ctx->refs = 0;
    VideoSt.Ctx->qmin = 2;
    VideoSt.Ctx->qmax = 31;
    VideoSt.Ctx->qcompress = 0.6;
    VideoSt.Ctx->width = ViewportSize.X;
    VideoSt.Ctx->height = ViewportSize.Y;
    VideoSt.Ctx->bit_rate = 4000000;
    VideoSt.Stream->time_base = VideoSt.Ctx->time_base = { 1, 30 };
    VideoSt.Ctx->gop_size = 25;
    VideoSt.Ctx->max_b_frames = 0;
    VideoSt.Ctx->thread_count = 1;
    VideoSt.Ctx->pix_fmt = AV_PIX_FMT_YUV420P;
    VideoSt.Ctx->codec_type = AVMEDIA_TYPE_VIDEO;

    if (FmtCtx->oformat->flags & AVFMT_GLOBALHEADER)
       VideoSt.Ctx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;

    }

    As answer to this question suggests same issue I use avcodec_alloc_context3. Am I doing something wrong or error caused buy another reason ?

    Below is the part where call to avcodec_open2 is. It’s called after Encoder::AddStream so everything is set up I guess.

    auto c = VideoSt.Ctx;
    AVDictionary* opt = nullptr;
    av_dict_copy(&opt, Opt, 0);
    auto ret = avcodec_open2(c, VideoCodec, &opt);

    What can cause Generic error in an external library ?

  • Compression of a video with constant background

    28 juin 2017, par Spirou003

    (sorry if my english is bad, I can read it but I don’t write it quite well...)

    I want to compress some videos, which have two particularities :

    • there is a background that covers 90% of the area, during the whole video
    • most of the others elements can be separately described by a picture in move

    My videos are like this one, and don’t have audio. As you can see, almost everything can be described only by using a fixed background, few small images in move, plus a noise. Moreover, this noise will be almost nul and then an entropic coding would be very efficient. I think it will produce tiny files (< 5 Mo) even if the duration is in hours, a result that is very appreciable since I have actually recorded 30h of game (actual size is 3 Go).

    Is there any way to get new video files, that benefit of these informations ? If yes, what are the implication of a such encoding for watching these videos with Windows Media Player, or for usage with ffmpeg ?

    I searched with Google after anything that can help me, but I don’t know which keyword I can use for this, then I didn’t found anything usefull :-(

    Thanks in advance :-)

    PS : another example, the video is accelerated but shows the interesting moves