Recherche avancée

Médias (17)

Mot : - Tags -/wired

Autres articles (106)

  • MediaSPIP 0.1 Beta version

    25 avril 2011, par

    MediaSPIP 0.1 beta is the first version of MediaSPIP proclaimed as "usable".
    The zip file provided here only contains the sources of MediaSPIP in its standalone version.
    To get a working installation, you must manually install all-software dependencies on the server.
    If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...)

  • Personnaliser en ajoutant son logo, sa bannière ou son image de fond

    5 septembre 2013, par

    Certains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;

  • Multilang : améliorer l’interface pour les blocs multilingues

    18 février 2011, par

    Multilang est un plugin supplémentaire qui n’est pas activé par défaut lors de l’initialisation de MediaSPIP.
    Après son activation, une préconfiguration est mise en place automatiquement par MediaSPIP init permettant à la nouvelle fonctionnalité d’être automatiquement opérationnelle. Il n’est donc pas obligatoire de passer par une étape de configuration pour cela.

Sur d’autres sites (10441)

  • Broadcast webcamer over ffserver and ffmpeg

    8 février 2019, par AkBako

    I setup the ffserver on Ubuntu 16.04 UPU. I did some streami from a .webm video fileы to the site. Now I can’t start streaming from the webcam of my laptop and show it on the website. Please need help.

    Technical info :

    Client-site:Windows 10

    WebCamera : YUV 4:2:2 640x480 fps 30.0

    Server-site : VPS Server Ubuntu 16.04

    ffserver.conf

    HTTPPort 8090
    HTTPBindAddress 0.0.0.0
    MaxHTTPConnections 2000
    MaxClients 1000
    MaxBandwidth 500000
    CustomLog -
    NoDaemon
    RTSPPort 7654
    RTSPBindAddress 0.0.0.0
    <feed>               # This is the input feed where FFmpeg will send
      File ./feed1.ffm            # video stream.
      FileMaxSize 1G              # Maximum file size for buffering video
    </feed>

    <stream>
       Feed feed1.ffm
       Format webm
       # Audio settings
       AudioCodec vorbis
       AudioBitRate 64             # Audio bitrate

       # Video settings
       VideoCodec libvpx
       VideoSize 640x480          # Video resolution
       VideoFrameRate 30           # Video FPS
       AVOptionVideo flags +global_header  # Parameters passed to encoder
                                          # (same as ffmpeg command-line parameters)
       AVOptionVideo cpu-used 0
       AVOptionVideo qmin 10
       AVOptionVideo qmax 42
       AVOptionVideo quality good
       AVOptionAudio flags +global_header
       PreRoll 15
       StartSendOnKey
       VideoBitRate 400
    </stream>

    <stream>
     Format status
     # Only allow local people to get the status
     ACL allow localhost
     ACL allow 192.168.0.0 192.168.255.255
    </stream>

    <redirect>    # Just an URL redirect for index
      # Redirect index.html to the appropriate site
      URL http://XX.XXX.XXX.XXX
    </redirect>

    Run code on Windows :

    ffmpeg -f dshow -i video="USB2.0 HD UVC WebCam" -video_size 640x480 -rtbufsize 702000k -framerate 30 -pixel_format yuyv422 -f mpegts http://XXX.XXX.XX.XX:8090/feed1.ffm

    Error message on Windows :

    Input #0, dshow, from 'video=USB2.0 HD UVC WebCam':
     Duration: N/A, start: 5326.566000, bitrate: N/A
       Stream #0:0: Video: mjpeg (Baseline) (MJPG / 0x47504A4D), yuvj422p(pc, bt470bg/unknown/unknown), 1280x720, 30 fps, 30 tbr, 10000k tbn, 10000k tbc
    Stream mapping:
     Stream #0:0 -> #0:0 (mjpeg (native) -> mpeg2video (native))
    Press [q] to stop, [?] for help
    [swscaler @ 06e5a000] deprecated pixel format used, make sure you did set range correctly
    Output #0, mpegts, to 'http://95.183.11.180:8090/feed1.ffm':
     Metadata:
       encoder         : Lavf58.24.101
       Stream #0:0: Video: mpeg2video (4:2:2), yuv422p, 1280x720, q=2-31, 200 kb/s, 30 fps, 90k tbn, 30 tbc
       Metadata:
         encoder         : Lavc58.42.103 mpeg2video
       Side data:
         cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
    av_interleaved_write_frame(): Unknown error
    Error writing trailer of http://95.183.11.180:8090/feed1.ffm: Error number -10054 occurred
    frame=    3 fps=0.0 q=1.6 Lsize=      46kB time=00:00:00.00 bitrate=34318545.5kbits/s speed=9.07e-05x
    video:84kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
    [http @ 06dd5c00] URL read error:  -10054
    Conversion failed!

    FFserver log :

    Fri Feb  8 03:14:58 2019 178.88.140.182 - - [POST] "/feed1.ffm HTTP/1.1" 200 4096
  • How can i mux H264 stream into MP4 file via libavformat

    14 août, par Brian

    I want to realize an application that firstly decode a multi-media file(such as test.mp4 file, video codec id is H264), get a video stream and an audio stream, then make some different in the audio stream, at last encode the video stream (use libx264) and audio stream into a result file (result.mp4). To promote the efficiency, I omitted the decode and encode of video stream, i get the video packet via function av_read_frame, then output it directly into the result file via function av_write_frame. But there is no picture in the output file, and the size of output file is fairly small.

    &#xA;

    I tracked the ffmpeg code and found that in the function av_write_frame->mov_write_packet->ff_mov_write_packet, it will call function ff_avc_parse_nal_units to obtain the size of nal unit, but the return value is very small (such as 208 bytes).

    &#xA;

    I find that the H264 stream in the MP4 file is not stored in Annex-B format, so it can't find start code (0x000001).

    &#xA;

    Now my problem is how can I change the H264 stream to Annex-B format, and make it work ?

    &#xA;

    I added start code at the beginning of every frame manually, but it still not work.

    &#xA;

    Following is the codes similar with my :

    &#xA;

    // write the stream header, if any&#xA;av_write_header(pFormatCtxEnc);&#xA;&#xA;.........&#xA;/**&#xA;* Init of Encoder and Decoder&#xA;*/&#xA;&#xA;bool KeyFlag = false;&#xA;bool KeyFlagEx = false;&#xA;// Read frames and save frames to disk&#xA;int iPts = 1;&#xA;av_init_packet(&amp;packet);&#xA;while(av_read_frame(pFormatCtxDec, &amp;packet)>=0)&#xA;{&#xA;        if (packet.flags == 1)&#xA;                KeyFlag = true;&#xA;&#xA;        if (!KeyFlag)&#xA;                continue;&#xA;&#xA;        if (m_bStop)&#xA;        {&#xA;                break;&#xA;        }&#xA;&#xA;        // Is this a packet from the video stream?&#xA;        if(packet.stream_index == videoStream)&#xA;        {&#xA;                currentframeNum &#x2B;&#x2B;;&#xA;                if (progressCB != NULL &amp;&amp; currentframeNum%20 == 0)&#xA;                {&#xA;                        float fpercent = (float)currentframeNum/frameNum;&#xA;                        progressCB(fpercent,m_pUser);&#xA;                }&#xA;&#xA;                if (currentframeNum >= beginFrame &amp;&amp; currentframeNum &lt;= endFrane)&#xA;                {&#xA;                        if (packet.flags == 1)&#xA;                                KeyFlagEx = true;&#xA;&#xA;                        if (!KeyFlagEx)&#xA;                                continue;&#xA;                        packet.dts = iPts &#x2B;&#x2B;;&#xA;                        av_write_frame(pFormatCtxEnc, &amp;packet);&#xA;&#xA;                }&#xA;        }&#xA;        // Free the packet that was allocated by av_read_frame&#xA;}&#xA;&#xA;// write the trailer, if any&#xA;av_write_trailer(pFormatCtxEnc);&#xA;&#xA;/**&#xA;* Release of encoder and decoder&#xA;*/&#xA;&#xA;return true;&#xA;

    &#xA;

  • FFmpeg - Output has only the first frame

    30 novembre 2018, par natario

    I am working on a simple 3 frames animated GIF and trying to get the same GIF as output after scaling down each frame.

    The program seems to work well, except for the fact that the output has a single frame only (no animation, just the first frame). What coding error can be causing this issue ?

    • I am setting the encoder time_base to the input AVStream.time_base, which in my case happens to be 1/100
    • I am writing each frame with av_interleaved_write_frame, setting the packet pts to the input AVFrame.pts (which happen to be 0, 40 and 80)
    • I know for sure that write function is called three times with these pts. The output GIF, analized at https://ezgif.com/split , actually contains 3 frames. But they are all identical.

    It’s sure this is an error within my program, so I am hoping that someone can give some clues as to why this could happen while muxing (incorrectly reusing some buffer, ....).

    Below are the most relevant parts (I am a beginner) :

    The main function :

    extern "C" int compress(Context* context) {
       context->error = avformat_write_header(context->outFormat, &amp;context->inFormat->metadata);
       if (hasError(context, "Writing headers")) return context->error;

       while (av_read_frame(context->inFormat, context->inPacket) >= 0) {
           AVPacket origPacket = *context->inPacket;
           int temp;
           do {
               context->error = decodePacket(context);
               if (hasError(context, "Decoding packet")) return context->error;
               temp = context->error;
               context->inPacket->data += temp;
               context->inPacket->size -= temp;
           } while (context->inPacket->size > 0);
           av_packet_unref(&amp;origPacket);
       }

       // flush cached frames and the decoder
       context->inPacket->data = NULL;
       context->inPacket->size = 0;
       do {} while (decodePacket(context) > 0);

       // Write the trailer
       context->error = av_write_trailer(context->outFormat);
       if (hasError(context, "Writing trailers")) return context->error;
       return 0;
    }

    The decodePacket function :

    extern "C" int decodePacket(Context* context) {
       int size = context->inPacket->size;
       int used = avcodec_send_packet(context->decoder, context->inPacket);
       if (used &lt; 0) return used;
       int error;
       while (used >= 0) {
           used = avcodec_receive_frame(context->decoder, context->inFrame);
           if (used == AVERROR(EAGAIN) || used == AVERROR_EOF) {
               return size;
           } else if (used &lt; 0) {
               return used;
           }
           error = encodeFrame(context);
           if (error &lt; 0) return error;
       }
       return size;
    }

    The writeFrame function :

    extern "C" int encodeFrame(Context* context) {
       sws_scale(context->scale, context->inFrame->data,
                 context->inFrame->linesize, 0,
                 context->inFrame->height, context->outFrame->data,
                 context->outFrame->linesize);
       AVPacket packet = { 0 };
       av_init_packet(&amp;packet);
       context->outFrame->pts = context->inFrame->pts;
       int temp = avcodec_send_frame(context->encoder, context->outFrame);
       if (temp &lt; 0) return temp;
       while (temp >= 0) {
           temp = avcodec_receive_packet(context->encoder, &amp;packet);
           if (temp == AVERROR(EAGAIN) || temp == AVERROR_EOF) {
               return 0;
           } else if (temp &lt; 0) {
               return temp;
           }

           packet.pts = context->inFrame->pts;
           int error = av_interleaved_write_frame(context->outFormat, &amp;packet);
           if (error &lt; 0) {
               return error;
           }    
       }
       return 0;
    }

    And finally this context struct that is being passed around :

    typedef struct Context {
       Context() {}
       AVFrame* inFrame = NULL;
       AVFrame* outFrame = NULL;
       AVStream* inStream = NULL;
       AVStream* outStream = NULL;
       AVFormatContext* outFormat = NULL;
       AVFormatContext* inFormat = NULL;
       struct SwsContext* scale = NULL;
       AVCodecContext* decoder = NULL;
       AVCodecContext* encoder = NULL;
       AVCodec* decoderCodec = NULL;
       AVCodec* encoderCodec = NULL;
       AVPacket* inPacket = NULL;
       int error = 0;
       const char* inFilename = NULL;
       const char* outFilename = NULL;
       int inStreamId = -1; // Video
       AVPixelFormat sourceFormat;
       AVPixelFormat destFormat;
       int sourceWidth, sourceHeight;
       int destWidth, destHeight;
    } Context;