Recherche avancée

Médias (1)

Mot : - Tags -/artwork

Autres articles (60)

  • Les autorisations surchargées par les plugins

    27 avril 2010, par

    Mediaspip core
    autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

  • Pas question de marché, de cloud etc...

    10 avril 2011

    Le vocabulaire utilisé sur ce site essaie d’éviter toute référence à la mode qui fleurit allègrement
    sur le web 2.0 et dans les entreprises qui en vivent.
    Vous êtes donc invité à bannir l’utilisation des termes "Brand", "Cloud", "Marché" etc...
    Notre motivation est avant tout de créer un outil simple, accessible à pour tout le monde, favorisant
    le partage de créations sur Internet et permettant aux auteurs de garder une autonomie optimale.
    Aucun "contrat Gold ou Premium" n’est donc prévu, aucun (...)

Sur d’autres sites (11884)

  • How to use FFMPEG API to decode to client allocated memory

    25 mars 2020, par VorpalSword

    I’m trying to use the FFMPEG API to decode into a buffer defined by the client program by following the tips in this question but using the new pattern for decoding instead of the now deprecated avcodec_decode_video2 function.

    If my input file is an I-frame only format, everything works great. I’ve tested with a .mov file encoded with v210 (uncompressed).

    However, if the input is a long-GoP format (I’m trying with H.264 high profile 4:2:2 in an mp4 file) I get the following pleasingly psychedelic/impressionistic result :

    Crowd run. On acid!

    There’s clearly something motion-vectory going on here !

    And if I let FFMPEG manage its own buffers with the H.264 input by not overriding AVCodecContext::get_buffer2, I can make a copy from the resulting frame to my desired destination buffer and get good results.

    Here’s my decoder method, _frame and _codecCtx are object members of type AVFrame* and AVCodecContext* respectively. They get alloc’d and init’d in the constructor.

           virtual const DecodeResult decode(const rv::sz_t toggle) override {
           _toggle = toggle & 1;
           using Flags_e = DecodeResultFlags_e;
           DecodeResult ans(Flags_e::kNoResult);

           AVPacket pkt;   // holds compressed data
           ::av_init_packet(&pkt);
           pkt.data = NULL;
           pkt.size = 0;
           int ret;

           // read the compressed frame to decode
           _err = av_read_frame(_fmtCtx, &pkt);
           if (_err < 0) {
               if (_err == AVERROR_EOF) {
                   ans.set(Flags_e::kEndOfFile);
                   _err = 0; // we can safely ignore EOF errors
                   return ans;
               } else {
                   baleOnFail(__PRETTY_FUNCTION__);
               }
           }

           // send (compressed) packets to the decoder until it produces an uncompressed frame
           do {

               // sender
               _err = ::avcodec_send_packet(_codecCtx, &pkt);
               if (_err < 0) {
                   if (_err == AVERROR_EOF) {
                       _err = 0; // EOFs are ok
                       ans.set(Flags_e::kEndOfFile);
                       break;
                   } else {
                       baleOnFail(__PRETTY_FUNCTION__);
                   }
               }

               // receiver
               ret = ::avcodec_receive_frame (_codecCtx, _frame);
               if (ret == AVERROR(EAGAIN)) {
                   continue;
               } else if (ret == AVERROR_EOF) {
                   ans.set(Flags_e::kEndOfFile);
                   break;
               } else if (ret < 0) {
                   _err = ret;
                   baleOnFail(__PRETTY_FUNCTION__);
               } else {
                   ans.set(Flags_e::kGotFrame);
               }

               av_packet_unref (&pkt);

           } while (!ans.test(Flags_e::kGotFrame));        

           //packFrame(); <-- used to copy to client image

           return ans;
       }

    And here’s my override for get_buffer2

           int getVideoBuffer(struct AVCodecContext* ctx, AVFrame* frm) {
           // ensure frame pointers are all null
           if (frm->data[0] || frm->data[1] || frm->data[2] || frm->data[3]){
               ::strncpy (_errMsg, "non-null frame data pointer detected.", AV_ERROR_MAX_STRING_SIZE);
               return -1;
           }

           // get format descriptor, ensure it's valid.
           const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(static_cast<avpixelformat>(frm->format));
           if (!desc) {
               ::strncpy (_errMsg, "Pixel format descriptor not available.", AV_ERROR_MAX_STRING_SIZE);
               return AVERROR(EINVAL);
           }

           // for Video, extended data must point to the same place as data.
           frm->extended_data = frm->data;

           // set the data pointers to point at the Image data.
           int chan = 0;
           IMG* img = _imgs[_toggle];
           // initialize active channels
           for (; chan &lt; 3; ++chan) {
               frm->buf[chan] =  av_buffer_create (
                   static_cast(img->begin(chan)),
                   rv::unsigned_cast<int>(img->size(chan)),
                   Player::freeBufferCallback, // callback does nothing
                   reinterpret_cast(this),
                   0 // i.e. AV_BUFFER_FLAG_READONLY is not set
               );
               frm->linesize[chan] = rv::unsigned_cast<int>(img->stride(chan));
               frm->data[chan] = frm->buf[chan]->data;
           }
           // zero out inactive channels
           for (; chan &lt; AV_NUM_DATA_POINTERS; ++chan) {
               frm->data[chan] = NULL;
               frm->linesize[chan] = 0;
           }
           return 0;
       }
    </int></int></avpixelformat>

    I can reason that the codec needs to keep reference frames in memory and so I’m not really surprised that this isn’t working, but I’ve not been able to figure out how to have it deliver clean decoded frames to client memory. I thought that AVFrame::key_frame would have been a clue, but, after observing its behaviour in gdb, it doesn’t provide a useful trigger for when to allocate AVFrame::bufs from the buffer pool and when they can be initialized to point at client memory.

    Grateful for any help !

  • Trouble with CoCCA Registry

    7 octobre 2012, par Multimedia Mike — General

    I’ve been rather despondent all week. People who see me daily could readily identify this fact. Unfortunately, the exact reason was difficult to adequately explain. The problems that nerds deal with…

    When A Domain Expires
    As a few people noticed, the multimedia.cx domain and all of it’s subdomains didn’t work this last week. The problem started on Monday, October 1. Whose fault ? Well, fundamentally, I neglected to renew the domain name in time. However, I prefer to place the blame on the .cx domain registrar, CoCCA Registry. You see, they have never developed the technology to email a domain holder with a notice that their domain is about to expire or has already expired.

    This domain is the only one I have ever held so I don’t have a lot of experience in this matter. I wondered if I was crazy for thinking it would be normal for a registrar to send an email or 2 with status updates about your domain. I get the impression from speaking with others that this is indeed normal. I have 3 different email addresses listed under my account at the registrar– 2 at multimedia.cx and a backup gmail account. I checked spam folders after this incident. Then I remembered that I have never received any email notifications from them (although password reset emails show up, so that part thankfully works). Also, their support emails are black holes.

    So, I guess the moral is : be wary of dealing with CoCCA Registry. However, they seem to be the only way to register domains under a wide variety of uncommon country codes.

    By Friday, the domain appeared to have been reinstated, even through the status was officially listed as “renewal-pending” according to the web-based management console. Eventually, as cached DNS results started to time out throughout the day, I started seeing subdomains come back. I excitedly used the ‘dig’ command to count down the seconds until gamemusic.multimedia.cx was accessible on the network I was on (the number after the domain name is the time-to-live or ‘TTL’ value) :

    $ dig +nocmd gamemusic.multimedia.cx +noall +answer
    gamemusic.multimedia.cx. 3      IN      A       174.143.152.251
    $ dig +nocmd gamemusic.multimedia.cx +noall +answer
    gamemusic.multimedia.cx. 2      IN      A       174.143.152.251
    $ dig +nocmd gamemusic.multimedia.cx +noall +answer
    gamemusic.multimedia.cx. 1      IN      A       174.143.152.251
    $ dig +nocmd gamemusic.multimedia.cx +noall +answer
    gamemusic.multimedia.cx. 12962  IN      A       207.45.186.114
    

    Finally, today (Saturday), I received a receipt confirming that the domain has been renewed.

    8 Years Old
    Incidentally, happy eighth birthday to multimedia.cx. It was September, 2004 when I decided to branch out from a simple ISP-based web presence.

    People often ask why I went with the .cx TLD. When I decided I wanted a proper domain name 8 years ago, I found that multimedia.X was already taken for just about every TLD value of X. .cx was a notable exception and was distinctive enough (speaking of .X, though, I see that multimedia.xxx is still up for grabs as of this writing ; I imagine that would come with a whole other set of problems).

    It’s funny that tech nerds often rail against outsourcing too much — email, storage, computing power, web hosting — all to some type of cloud provider under the premise that it could easily be taken away. But this episode teaches me that even having your own domain name is no guarantee of a solid online presence.

    Meanwhile, I have taken proactive steps to avert this same situation from arising again :



    Barring a lack of automated emails from the registrar, I hope a Google Calendar reminder set up a month ahead of expiration will do the trick.

  • FFmpeg transcoding video H.264 -> AV1 leads to distorted image

    21 juin 2023, par user1584149

    I'm reading video from stdin via pipe similar to this one Python gets stuck at pipe.stdin.write(image.tostring())

    &#xA;

    FFmpeg is using libsvtav1 codec with options according to documentation

    &#xA;

    ffmpeg -y -f rawvideo -i pipe:0 -s {frame_width}x{frame_height} -r {frame_rate} -c:a copy -c:v libsvtav1 -preset 6 -crf 30 -svtav1-params "color-format=1:film-grain-denoise=0:mbr=2M" {output_file} &#xA;

    &#xA;

    Here's couple of details about used FFmpeg version as well as input video

    &#xA;

    ffmpeg version n5.1.3-14-ge5b5dd6653-20230621 Copyright (c) 2000-2022 the FFmpeg developers&#xA;  built with gcc 13.1.0 (crosstool-NG 1.25.0.196_227d99d)&#xA;  configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-ffbuild-linux-gnu- --arch=x86_64 --target-os=linux --enable-gpl --enable-version3 --disable-debug --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-openssl --enable-lzma --enable-fontconfig --enable-libvorbis --enable-opencl --enable-libpulse --enable-libvmaf --enable-libxcb --enable-xlib --enable-amf --enable-libaom --enable-libaribb24 --enable-avisynth --disable-chromaprint --enable-libdav1d --enable-libdavs2 --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libkvazaar --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librist --enable-libssh --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --disable-openal --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-librav1e --enable-librubberband --disable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --enable-libdrm --enable-vaapi --enable-libvidstab --enable-vulkan --enable-libshaderc --disable-libplacebo --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-ldexeflags=-pie --extra-libs=&#x27;-ldl -lgomp&#x27; --extra-version=20230621&#xA;  libavutil      57. 28.100 / 57. 28.100&#xA;  libavcodec     59. 37.100 / 59. 37.100&#xA;  libavformat    59. 27.100 / 59. 27.100&#xA;  libavdevice    59.  7.100 / 59.  7.100&#xA;  libavfilter     8. 44.100 /  8. 44.100&#xA;  libswscale      6.  7.100 /  6.  7.100&#xA;  libswresample   4.  7.100 /  4.  7.100&#xA;  libpostproc    56.  6.100 / 56.  6.100&#xA;Input #0, rawvideo, from &#x27;pipe:0&#x27;:&#xA;  Duration: N/A, start: 0.000000, bitrate: 331776 kb/s&#xA;  Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 1280x720, 331776 kb/s, 30 tbr, 30 tbn&#xA;Stream mapping:&#xA;  Stream #0:0 -> #0:0 (rawvideo (native) -> av1 (libsvtav1))&#xA;Svt[info]: -------------------------------------------&#xA;Svt[info]: SVT [version]:   SVT-AV1 Encoder Lib v1.5.0-12-g0f8b3a81&#xA;Svt[info]: SVT [build]  :   GCC 13.1.0   64 bit&#xA;Svt[info]: LIB Build date: Jun 20 2023 23:48:14&#xA;Svt[info]: -------------------------------------------&#xA;

    &#xA;

    The output video transcoded by SVT-AV1 codec is blemished as you can see on the images below. Normally I would say it could be caused by wrong pixel format, but input stream has yuv420 format what is the same as encoder's pixel format parameter —color-format.

    &#xA;

    Please share your experience or ideas how to get it transcoding correctly.

    &#xA;

    Thanks in advance.

    &#xA;

    Image 1&#xA;Image 2

    &#xA;