Recherche avancée

Médias (3)

Mot : - Tags -/Valkaama

Autres articles (35)

  • La file d’attente de SPIPmotion

    28 novembre 2010, par

    Une file d’attente stockée dans la base de donnée
    Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
    Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...)

  • Organiser par catégorie

    17 mai 2013, par

    Dans MédiaSPIP, une rubrique a 2 noms : catégorie et rubrique.
    Les différents documents stockés dans MédiaSPIP peuvent être rangés dans différentes catégories. On peut créer une catégorie en cliquant sur "publier une catégorie" dans le menu publier en haut à droite ( après authentification ). Une catégorie peut être rangée dans une autre catégorie aussi ce qui fait qu’on peut construire une arborescence de catégories.
    Lors de la publication prochaine d’un document, la nouvelle catégorie créée sera proposée (...)

  • Gestion générale des documents

    13 mai 2011, par

    MédiaSPIP ne modifie jamais le document original mis en ligne.
    Pour chaque document mis en ligne il effectue deux opérations successives : la création d’une version supplémentaire qui peut être facilement consultée en ligne tout en laissant l’original téléchargeable dans le cas où le document original ne peut être lu dans un navigateur Internet ; la récupération des métadonnées du document original pour illustrer textuellement le fichier ;
    Les tableaux ci-dessous expliquent ce que peut faire MédiaSPIP (...)

Sur d’autres sites (5638)

  • 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;

  • lavfi : generalize colorspace coefficent helpers

    9 avril 2022, par Niklas Haas
    lavfi : generalize colorspace coefficent helpers
    

    These are needed beyond just vf_colorspace, so give them a new home in
    colorspace.h.

    In addition to moving code around, also merge the white point and
    primary coefficients into a single struct to slightly increase the
    convenience and shrink the size of the new API by avoiding the need
    to introduce an extra function just to look up the white point as well.
    The only place the distinction matters is in a single enum comparison,
    which can just as well be a single memcpy - the difference is
    negligible.

    Signed-off-by : Niklas Haas <git@haasn.dev>

    • [DH] libavfilter/colorspace.c
    • [DH] libavfilter/colorspace.h
    • [DH] libavfilter/vf_colorspace.c
  • FFMPEG re-broadcast/proxy MJPEG stream

    10 septembre 2022, par Ollie Pugh

    I have an MJPEG stream coming from an RPI on my home network and have an NGINX acting as a proxy on an EC2.

    &#xA;

    For the camera access the flow of stream to the user is the following

    &#xA;

    RPi -> mjpeg-proxy (running on EC2) -> NGINX (running on same EC2) -> user

    &#xA;

    the point of mjpeg-proxy is to reduce the load on the RPi and only have one stream to the Pi and allow the EC2 to distribute that one stream.

    &#xA;

    Now this work fine-ish from my PC (on same network as Pi) the streams work perfectly. But when it comes to my phone on roaming data, the stream is super choppy and the latency grows massively (this project needs minimal latency, like sub 300ms).

    &#xA;

    I can't understand why this would happen ? Because even when running of my local PC its going through the Proxy hosted in the cloud, so its not as if its an advantage to it being local ?

    &#xA;

    the stream is fine on another device, e.g. my laptop, but thats on the same network as the RPi. But like I said, it shouldn't makea difference as its going through a proxy !

    &#xA;

    I was wondering if using FFMPEG to re-stream the mjpeg stream would be beneficial as node is notoriously slow. But I don't really want to be writing my own mjpeg-proxy in C++ to speed this all up.

    &#xA;

    I have looked online for answers to FFMPEG MJPEG proxy and have been very unsuccesful

    &#xA;