Recherche avancée

Médias (91)

Autres articles (80)

  • Websites made ​​with MediaSPIP

    2 mai 2011, par

    This page lists some websites based on MediaSPIP.

  • 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

  • Contribute to a better visual interface

    13 avril 2011

    MediaSPIP is based on a system of themes and templates. Templates define the placement of information on the page, and can be adapted to a wide range of uses. Themes define the overall graphic appearance of the site.
    Anyone can submit a new graphic theme or template and make it available to the MediaSPIP community.

Sur d’autres sites (17291)

  • For custom FFmpeg I/O API : incorrect data about write_packet Callback function of avio_alloc_context()

    13 avril 2021, par oaho

    I would like to ask a question about ffmpeg custom I/O api.

    


    Description of the problem : I used the FFmpeg official example - remuxing.c to test a simple conversion package operation. (test1.ts -> test1.mp4). This operation result is normal.
But when I use Custom I/O

    


    


    avio_alloc_context(buf, 65535, 1, nullptr, nullptr, write_cb, seek) ;

    


    


    function, the custom I/O output is written to the memory, and then the mp4 file is written from this memory. It is found that the output file data is different from Internal file Protocol write. VLC and MediaInfo can't probe it.

    


    I Use Beyond Compare4 to compare file data :

    


    Beyond Compare 4 Picture Comparasion

    


    In this picture, the left is my customized I/O output, and the right is the official example (according to file URLProtocol to Output)

    


    I tested it many times, and each time the data size, data location, and data content are all in the same place. When I change the data of the few bytes with the difference on the left to the data on the right, VLC can play normally.

    


    Is my operation improper, or is it another problem ?

    


    Source Code :

    


    extern "C"{&#xA;#include <libavformat></libavformat>avformat.h>&#xA;#include <libavcodec></libavcodec>avcodec.h>&#xA;}&#xA;#include &#xA;#include <cstdio>&#xA;#include &#xA;void process_error(int ret, const char* info)&#xA;{&#xA;   if( ret &lt; 0)&#xA;   {&#xA;      fprintf(stderr, info);&#xA;      std::exit(-1);&#xA;   }&#xA;}&#xA;int fd;&#xA;int write_packet(void *opaque, uint8_t *buf, int buf_size)&#xA; {&#xA;      int ret;&#xA;      ret = write(fd, buf, buf_size);&#xA;      printf("write bytes %d\n", ret);&#xA;      return (ret == -1) ? AVERROR(errno) : ret;&#xA; }&#xA; int64_t seek(void *opaque, int64_t offset, int whence)&#xA; {&#xA;      return offset;&#xA; }&#xA;&#xA; int main()&#xA; {&#xA;&#xA;     fd = open("/home/oaho/Desktop/22.mp4", O_CREAT | O_WRONLY, 0777);&#xA;     if ( fd &lt; 0)&#xA;     {&#xA;        return -1;&#xA;     }&#xA;&#xA;&#xA;     AVFormatContext *inputContext = nullptr;&#xA;     AVFormatContext *ouputContext = nullptr;&#xA;&#xA;     int ret = avformat_open_input(&amp;inputContext, "/home/oaho/Desktop/test1.ts", nullptr, nullptr);&#xA;     process_error(ret, "could&#x27;not open input\n");&#xA;     ret = avformat_find_stream_info(inputContext, nullptr);&#xA;     process_error(ret, "could&#x27;not find stream information\n");&#xA;&#xA;     avformat_alloc_output_context2(&amp;ouputContext, nullptr, "mp4", nullptr);&#xA;     if( ouputContext == nullptr)&#xA;     process_error(-1, "could&#x27;not alloc outputContext\n");&#xA;&#xA;&#xA;     if( ouputContext->oformat==nullptr)&#xA;     {&#xA;        ouputContext->oformat = av_guess_format("mp4", nullptr, nullptr);&#xA;     }&#xA;&#xA;     uint8_t* buf = nullptr;&#xA;     buf = (uint8_t*)av_malloc(200 * 1024);&#xA;     if( buf == nullptr)&#xA;     {&#xA;        return -1;&#xA;     }&#xA;     ouputContext->pb = nullptr;&#xA;     ouputContext->pb = avio_alloc_context(buf, 200 * 1024, 1, nullptr, nullptr, write_packet, seek);&#xA;     if( ouputContext->pb == nullptr)&#xA;     {&#xA;        return -1;&#xA;     }&#xA;     ouputContext->flags = AVFMT_FLAG_CUSTOM_IO;&#xA;     //pre the stream avalible&#xA;     int *arr = new int[inputContext->nb_streams];&#xA;     if( arr == nullptr )&#xA;       process_error(-1, "can&#x27;t alloc array\n");&#xA;     int stream_index = 0;&#xA;     //get stream : video stream , audio stream , subtitle stream&#xA;     for(int i = 0;i &lt; inputContext->nb_streams;i&#x2B;&#x2B;)&#xA;     {&#xA;        //get the single stream&#xA;        AVStream *stream = inputContext->streams[i];&#xA;        AVStream *outStream = nullptr;&#xA;        AVCodecParameters *codec = stream->codecpar;&#xA;        if(   codec -> codec_type != AVMediaType::AVMEDIA_TYPE_VIDEO&#xA;           &amp;&amp; codec -> codec_type != AVMediaType::AVMEDIA_TYPE_AUDIO&#xA;           &amp;&amp; codec -> codec_type != AVMediaType::AVMEDIA_TYPE_SUBTITLE)&#xA;        {&#xA;            arr[i] = -1;&#xA;            continue;&#xA;        }&#xA;        arr[i] = stream_index&#x2B;&#x2B;;&#xA;        outStream = avformat_new_stream(ouputContext, nullptr);&#xA;        if(outStream == nullptr)&#xA;           goto end;&#xA;        int ret = avcodec_parameters_copy(outStream->codecpar, stream->codecpar);&#xA;        if( ret &lt; 0)&#xA;           goto end;&#xA;         //not include additional information&#xA;        outStream->codecpar->codec_tag = 0;&#xA;      }&#xA;      ret = avformat_write_header(ouputContext, nullptr);&#xA;      process_error(ret, "can&#x27;t write header\n");&#xA;&#xA;      while(1)&#xA;      {&#xA;          AVPacket pkt;&#xA;          av_init_packet(&amp;pkt);&#xA;          AVStream *in_stream, *out_stream;&#xA;          ret = av_read_frame(inputContext, &amp;pkt);&#xA;          if( ret &lt; 0)&#xA;             break;  &#xA;          in_stream  = inputContext->streams[pkt.stream_index];&#xA;          if (arr[pkt.stream_index] &lt; 0) {&#xA;             av_packet_unref(&amp;pkt);&#xA;             continue;&#xA;          }&#xA;          pkt.stream_index = arr[pkt.stream_index];&#xA;          out_stream = ouputContext->streams[pkt.stream_index];&#xA;          /* copy packet */&#xA;          pkt.pts = av_rescale_q(pkt.pts, in_stream->time_base, out_stream->time_base);&#xA;          pkt.dts = av_rescale_q(pkt.dts, in_stream->time_base, out_stream->time_base);&#xA;          pkt.duration = av_rescale_q(pkt.duration, in_stream->time_base, out_stream->time_base);&#xA;          pkt.pos = -1;&#xA;          //log_packet(ofmt_ctx, &amp;pkt, "out");&#xA;          ret = av_interleaved_write_frame(ouputContext, &amp;pkt);&#xA;          if (ret &lt; 0) {&#xA;            fprintf(stderr, "Error muxing packet\n");&#xA;            break;&#xA;          }&#xA;          av_packet_unref(&amp;pkt);&#xA;       }&#xA;       av_write_trailer(ouputContext);&#xA;  end:&#xA;       close(fd);&#xA;       delete [] arr;&#xA;       avformat_free_context(inputContext);&#xA;       avformat_free_context(ouputContext);&#xA;       return 0;&#xA; }&#xA;</cstdio>

    &#xA;

  • Exactly what parameters are needed by libva/VAAPI to decode an H.264 video frame ?

    12 juillet 2022, par Synthetix

    I've got a basic Linux app running on supported Intel hardware that uses Intel's libva (VAAPI) to decode H.264 frames from an MP4 file. I have the entire thing working except the part where the frame gets submitted to the GPU/decoder. What's unclear is exactly what information to submit, when, and it what order. I don't see any official documentation on this, either. Here's the point in the code I'm referring to :

    &#xA;

    vaBeginPicture(...)&#xA;vaRenderPicture(...)&#xA;vaEndPicture(...)&#xA;

    &#xA;

    The functions vaBeginPicture and vaEndPicture are self-explanatory, but my issue is with vaRenderPicture. I would expect to need to send the SPS and PPS (out of the AVCC atom in the MP4 file), then each frame, or slice of frames to the decoder via vaRenderPicture(). But this isn't mentioned anywhere other than in code examples I've found online. From some of these examples, I've surmised the following :

    &#xA;

    vaRenderPicture() // call 1/4: VAPictureParameterBufferH264: Send picture params? e.g. frame size and SPS/PPS?&#xA;vaRenderPicture() // call 2/4: VAIQMatrixBufferH264: Send inverse matrix? Where do I get this?&#xA;vaRenderPicture() // call 3/4: VASliceParameterBufferH264: Parameters of the next slice of H.264 picture data?&#xA;vaRenderPicture() // call 4/4: Slice Data? The actual compressed H.264 data from the file?&#xA;

    &#xA;

    I have a very rudimentary understanding of how H.264 data is arranged in an MP4. But the libva documentation, as far as I can tell, does not explain exactly what is needed and in what order to successfully decode a frame. Furthermore, the buffer structures submitted to the decoder have an extensive amount of fields, which implies I need to know a ton of information about the frames before I submit them. In other video APIs I've used, none of this is needed. Why so complex ?

    &#xA;

    Any pointers to documentation on exactly what parameters, data and how to arrange it all before submitting to the VAAPI decoder would be much appreciated.

    &#xA;

  • Compiling FFMPEG with libvpx on Mac OS X

    26 août 2014, par Dalvik

    I’m having hard timed trying to manually compile FFMPEG on my MAC. I’m trying to compile it with —enable-libvpx but keep getting this annoying error :

    ERROR: libvpx decoder version must be >=0.9.1"

    I’m compiling FFMPEG using this guide by ROMAN10 and this link from the FFMPEG official documentation. You can find the build script I’m using in ROMAN’s web page.

    Note : I’m working with HomeBrew because I found it easier and more convenient tool from which I can install all the core packages that ffmpeg requires(yasm,libogg,libvorbis and more).

    In an efforts to solve it I’ve try to fix ffmpeg’s ./configure file and notice that the link to libvpx is as follow :

    enabled libvpx            &amp;&amp; {
    enabled libvpx_vp8_decoder &amp;&amp; { check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_dec_init_ver -lvpx ||
                                   die "ERROR: libvpx decoder version must be >=0.9.1"; }
    enabled libvpx_vp8_encoder &amp;&amp; { check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_enc_init_ver VP8E_SET_MAX_INTRA_BITRATE_PCT" -lvpx ||
                                   die "ERROR: libvpx encoder version must be >=0.9.7"; }
    enabled libvpx_vp9_decoder &amp;&amp; { check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" "vpx_codec_vp9_dx" -lvpx || disable libvpx_vp9_decoder; }
    enabled libvpx_vp9_encoder &amp;&amp; { check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_vp9_cx VP9E_SET_AQ_MODE" -lvpx || disable libvpx_vp9_encoder; } }

    You can see that the method check_lib2 receives 2 params - the header path and the function’s name. Unfortunately even when I’m changing the path to a downloaded version of libvpx(which is much newer than 0.9.1) I’m still getting this error. Any help would be much appreciated.