Recherche avancée

Médias (2)

Mot : - Tags -/plugins

Autres articles (74)

  • Websites made ​​with MediaSPIP

    2 mai 2011, par

    This page lists some websites based on MediaSPIP.

  • Creating farms of unique websites

    13 avril 2011, par

    MediaSPIP platforms can be installed as a farm, with a single "core" hosted on a dedicated server and used by multiple websites.
    This allows (among other things) : implementation costs to be shared between several different projects / individuals rapid deployment of multiple unique sites creation of groups of like-minded sites, making it possible to browse media in a more controlled and selective environment than the major "open" (...)

  • Ecrire une actualité

    21 juin 2013, par

    Présentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
    Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
    Vous pouvez personnaliser le formulaire de création d’une actualité.
    Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...)

Sur d’autres sites (16256)

  • How to get FFMPEG to use more GPU when encoding

    24 mars 2023, par Entropy

    so the situation is as following

    


    Im receiging 20/30 uncompressed image per second. format is either PNG or Bitmap. Each individual photo size is between 40 and 50 mb (all have same size since uncompressed).

    


    I want to encode them to a 265 lossless video and stream them to a http server using FFMPEG.
The output video is 1920x1080, so there is some downsampling.
Compression is allowed but nothing is allowed to be lost other than the down sampling.

    


    now i m still in the testing phase. i have a 500 sample image. and i m tryng to encode them as effeciently as possible.
Im using commands such as :

    


    ffmpeg  -hwaccel cuvid -f  image2  -i "0(%01d).png" -framerate 30 / 
-pix_fmt p010le -c:v hevc_nvenc -preset lossless -rc vbr_hq /
-b:v 6M -maxrate:v 10M  -vf scale=1920:1080  -c:a aac -b:a 240k result.mp4


    


    I have a powerfull modern quadro GPU and a 6 cores intel CPU and an Nvme hard drive.

    


    The usuage of the GPU when encoding is exactly 10%, CPU is circa 30-40%

    


    How can i get GPU usuage to 80% ? The machine on which im going to run the code will have at leat a quadro 4000 (maybe stronger) and i want to use it to the fullest

    


  • FFmpeg loses first two frames

    13 avril 2018, par CoXier

    I want to decode input video file and get some info such as frame count.

    Here is input file link : https://drive.google.com/file/d/1LilwULBNQp-uVVzyRjAUwbgjGxaoLFs8/view?usp=sharing

    AVStream#nb_frames

    I can get frame count without decoding input video.

    av_register_all();

    AVFormatContext *pFormatContext = avformat_alloc_context();
    if (!pFormatContext) {
       return -1;
    }

    if (avformat_open_input(&pFormatContext, input_file, nullptr, nullptr) != 0) {
       return -1;
    }

    # GetVideoStreamIndex just used to get video stream index
    int videoStreamIndex = GetVideoStreamIndex(pFormatContext);

    int64_t frames = pFormatContext->streams[videoStreamIndex]->nb_frames;

    I got 596 frames.

    decode

    Another way is decoding video file. Here is my code.

    av_register_all();

    AVFormatContext *pFormatContext = avformat_alloc_context();
    avformat_open_input(&pFormatContext, input_file, nullptr, nullptr);
    int videoStreamIndex = GetVideoStreamIndex(pFormatContext);

    AVCodecParameters *pCodecParameters = pFormatContext->streams[videoStreamIndex]->codecpar;
    AVCodec *pCodec = avcodec_find_decoder(pCodecParameters->codec_id);
    AVCodecContext *pCodecContext = avcodec_alloc_context3(pCodec);
    avcodec_parameters_to_context(pCodecContext, pCodecParameters);
    avcodec_open2(pCodecContext, pCodec, nullptr);

    AVPacket *pPacket = av_packet_alloc();
    AVFrame *pFrame = av_frame_alloc();


    while (av_read_frame(pFormatContext, pPacket) >= 0) {
       if (pPacket->stream_index == videoStreamIndex) {
           decode_packet(pCodecContext, pPacket, pFrame);
       }
       av_packet_unref(pPacket);
    }

    avformat_free_context(pFormatContext);
    av_packet_free(&pPacket);
    av_frame_free(&pFrame);
    avcodec_free_context(&pCodecContext);

    And decode_packet method :

    static void decode_packet(AVCodecContext *pCodecContext, AVPacket *pPacket, AVFrame *pFrame) {
       // Supply raw packet data as input to a decoder
       // https://ffmpeg.org/doxygen/trunk/group__lavc__decoding.html#ga58bc4bf1e0ac59e27362597e467efff3
       int response = avcodec_send_packet(pCodecContext, pPacket);
       if (response != 0) {
           fprintf(stderr, "Error while sending a packet to the decoder: %s\n", av_err2str(response));
           return;
       }
       while (response >= 0) {
           response = avcodec_receive_frame(pCodecContext, pFrame);
           if (response == AVERROR(EAGAIN) || response == AVERROR_EOF) {
               break;
           } else if (response < 0) {
               fprintf(stderr, "Error while receiving frame: %s\n", av_err2str(response));
               break;
           }
           fprintf(stdout, "Frame %d\n", pCodecContext->frame_number);
           av_frame_unref(pFrame);
       }
    }

    However I got 594 frames.

    After I log some info, I found first two frames lost.

    response = avcodec_receive_frame(pCodecContext, pFrame);

    First two response is AVERROR(EAGAIN).

  • RoQ on Dreamcast

    18 mars 2011, par Multimedia Mike — Sega Dreamcast

    I have been working on that challenge to play back video on the Sega Dreamcast. To review, I asserted that the RoQ format would be a good fit for the Sega Dreamcast hardware. The goal was to play 640x480 video at 30 frames/second. Short version : I have determined that it is possible to decode such video in real time. However, I ran into certain data rate caveats.

    First off : Have you ever wondered if the Dreamcast can read an 80mm optical disc ? It can ! I discovered this when I only had 60 MB of RoQ samples to burn on a disc and a spindle full of these 210MB-capacity 80mm CD-Rs that I never have occasion to use.



    New RoQ Library
    There are open source RoQ decoders out there but I decided to write a new one. A few reasons : 1) RoQ is so simple that I didn’t think it would take too long ; 2) it would be nice to have a RoQ library that is license-compatible (BSD-like) with the rest of the KallistiOS distribution ; 3) the idroq.tar.gz distribution, while license-compatible, has enough issues that I didn’t want to correct it.

    Thankfully, I was correct about the task not being too difficult : I put together a new RoQ decoder in short order. I’m a bit embarrassed to admit that the part I had the most trouble with was properly converting YUV -> RGB.

    About the approach I took : While the original idroq.tar.gz decoder maintains YUV 4:2:0 codebooks (which led to chroma bugs during motion compensation) and FFmpeg’s decoder maintains YUV 4:4:4 codebooks, this decoder is built to convert the YUV 4:2:0 vectors into RGB565 vectors during the vector unpacking phase. Thus, the entire frame is rendered in RGB565 — no lengthy YUV -> RGB conversion after decoding — and all pixels are shuffled around as 16-bit units (minor speedup vs. shuffling everything as bytes).

    I also entertained the idea of maintaining YUYV codebooks (since the DC supports that colorspace as a texture format). But I scrapped that idea when I remembered it would lead to the same chroma bleeding problem seen in the original idroq.tar.gz decoder.

    Onto The Dreamcast
    I developed the library on a Linux computer, allowing it to output a series of PNM files for visual verification and debugging. Dropping it into a basic DC/KOS-compatible program was trivial and the first order of business was profiling.

    At first, I profiled the entire decode operation : open file, then read and decode each chunk while tossing away the results. I was roundly disappointed to see that, e.g., an 8.5-second RoQ sample needed a little more than 20 seconds to complete. Not real time. I performed a series of optimizations on the decoding library that netted notable performance gains when profiling on Linux. When I brought these same optimizations over to the DC, decoding time didn’t improve at all. This was my first suspicion that perhaps my assumptions regarding the DC’s optical drive’s data rate were not correct.

    Dreamcast Data Rate Profiling
    Let’s start with some definitions : In terms of data rate, an ’X’, i.e., 1X is the minimum data rate needed to read CD quality audio from a disc. At that speed, a drive should be able to stream 75 sectors each second. When reading mode 1/form 1 CD-ROM data, each sector has 2048 bytes (2 kbytes), so a single-speed data rate should achieve 150 kbytes/sec.

    The Dreamcast is supposed to possess a 12X optical drive. This would imply a maximum data rate of 150 kbytes/sec * 12 = 1800 kbytes/sec.

    Rigging up a trivial experiment using the RoQ samples burned on a few different CD-R discs, the best data rate I can see is about 500-525 kbytes/sec, or around 3.5X.

    Where’s the discrepancy ? My first theory has to do with the fact that not all optical media is created equal. This is why optical drives often advertise a slew of numbers which refer to the best theoretical speed for reading a CD vs. writing a CD-R vs. writing a CD-RW, etc. Perhaps the DC drive can’t read CD-Rs very quickly. To test this theory, I tried streaming a large file from a conventionally mastered CD-ROM. This worked well for the closest CD-ROM I had on hand : I was able to stream data at a rate that works out to about 6.5X.

    I smell a science project for another evening : Profiling read speeds from a mastered CD-ROM, burned CD-R, and also a mastered GD-ROM, on each of the 3 Dreamcast consoles I possess (I’ve heard that there’s variance between optical drives depending on manufacturing run).

    The Good News
    I added a little finer-grained code to profile just the video decoding functions. The good news is that the decoder meets my real time goals : That 8.5-second RoQ sample encoded at 640x480x30fps makes its way through the video decoding functions on the DC in a little less than 5 seconds. If the optical drive can supply the data fast enough, the video decoder can take care of the rest.

    The RoQ encoder included with FFmpeg does not honor any bitrate parameters. Instead, I encoded the same file at 320x240. It reportedly decoded in real time and can be streamed in real time as well.

    I say "reportedly" because I’m simply working from textual output at this point ; the next phase is to hook the decoder up to the display hardware.