Recherche avancée

Médias (91)

Autres articles (75)

  • MediaSPIP v0.2

    21 juin 2013, par

    MediaSPIP 0.2 est la première version de MediaSPIP stable.
    Sa date de sortie officielle est le 21 juin 2013 et est annoncée ici.
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Comme pour la version précédente, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

  • XMP PHP

    13 mai 2011, par

    Dixit Wikipedia, XMP signifie :
    Extensible Metadata Platform ou XMP est un format de métadonnées basé sur XML utilisé dans les applications PDF, de photographie et de graphisme. Il a été lancé par Adobe Systems en avril 2001 en étant intégré à la version 5.0 d’Adobe Acrobat.
    Étant basé sur XML, il gère un ensemble de tags dynamiques pour l’utilisation dans le cadre du Web sémantique.
    XMP permet d’enregistrer sous forme d’un document XML des informations relatives à un fichier : titre, auteur, historique (...)

  • Use, discuss, criticize

    13 avril 2011, par

    Talk to people directly involved in MediaSPIP’s development, or to people around you who could use MediaSPIP to share, enhance or develop their creative projects.
    The bigger the community, the more MediaSPIP’s potential will be explored and the faster the software will evolve.
    A discussion list is available for all exchanges between users.

Sur d’autres sites (12589)

  • Prevent FFmpeg from closing when a named pipe has been read completely

    21 octobre 2019, par Werther Berselli

    I’m doing a C++ application for a university project that takes a video file (e.g. matroska) and using FFmpeg (embedding commands inside std::system() instructions) apply these steps :

    • Extract chunks of frames (e.g. 10 seconds per chunk) and chunks of .aac audio

    • Apply some filters to frames

    • Encode video chunk and audio chunk with x264 and send it to a listening client using RTSP. This step is achieved using two named pipes, one for video and one for audio.

    • Receive the stream into another process and play it using ffplay (on localhost or lan).

    I need to divide my stream in chunks because I need eventually to satisfy real-time constraints, so I can’t apply filters before to my entire input video file and only then start streaming to client.
    My primary problem here is that once FFmpeg has emptied the two pipes, it close ; but other chunks of video and audio have still to be piped and streamed. I need FFmpeg to listen to the pipes waiting for new data.

    In bash I achieved this with the following commands.

    Start to listen in a prompt for a RTSP stream :

    ffplay -rtsp_flags listen rtsp://127.0.0.1@127.0.0.1:8090

    Create a video named pipe and an audio named pipe :

    mkfifo video_pipe
    mkfifo audio_pipe

    Use this command to prevent FFmpeg to close when video pipe is emptied :

    exec 7<>video_pipe

    (it is sufficient to apply it to the pipe video and neither will the audio pipe give problems)

    Activate FFmpeg command

    ffmpeg -probesize 2147483647 -re -s 1280x720 -pix_fmt rgb24 -i pipe:0 -vsync 0 -i audio_pipe -r 25 -vcodec libx264 -crf 23 -preset ultrafast -f rtsp -rtsp_transport tcp rtsp://127.0.0.1@127.0.0.1:8090 < video_pipe

    And then feed the pipes in another prompt :

    cat audiochunk.aac > audio_pipe & cat frame*.bmp > video_pipe

    These commands work well using 3 prompts, then I tried them in C++ embedding commands in std::system() instructions (using different threads) ; everything works, but once ffmpeg command empty the video pipe (finishing first chunk), it closes.
    exec command seems to be uneffective here.
    How could I prevent FFmpeg from closing ?

    Two days struggling on that problem, viewing all possible internet solution. I hope I was clear despite a great headache, thanks for your suggestions in advance.

    UPDATE :
    My C++ code is something like this ; I putted it in a single function on a single thread, but it doesn’t change it’s behaviour.
    I’m on Ubuntu 18.04.2

    void CameraThread::ffmpegJob()
    {
       std::string strvideo_length, command, timing;
       long video_length, begin_chunk, end_chunk;
       int begin_h, begin_m, begin_s, end_h, end_m, end_s;

       command = "ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 " + Configurations::file_name;
       strvideo_length = execCmd(command.c_str());
       strvideo_length.pop_back(); // remove \n character
       video_length = strToPositiveDigit(strvideo_length);

       if(video_length == -1)
       {
           std::cout << "Invalid input file";
           return;
       }

       std::system("bash -c \"rm mst-temp/mst_video_pipe\"");
       std::system("bash -c \"rm mst-temp/mst_audio_pipe\"");
       std::system("bash -c \"mkfifo mst-temp/mst_video_pipe\"");
       std::system("bash -c \"mkfifo mst-temp/mst_audio_pipe\"");
       // Keep video pipe opened
       std::system("bash -c \"exec 7<>mst-temp/mst_video_pipe\"");

       std::string rtsp_url = "rtsp://" + Configurations::my_own_used_ip + "@" + Configurations::client_ip +
               ":" + std::to_string(Configurations::port + 1);

       command = "ffmpeg -probesize 2147483647 -re -s 1280x720 -pix_fmt rgb24 -i pipe:0 "
                 "-i mst-temp/mst_audio_pipe -r 25 -vcodec libx264 -crf 23 -preset ultrafast -f rtsp "
                 "-rtsp_transport tcp " + rtsp_url + " < mst-temp/mst_video_pipe &"; // Using & to continue without block on command
       std::system(command.c_str());

       begin_chunk = -1 * VIDEO_CHUNK;
       end_chunk = 0;

       // Extract the complete audio track
       command = "bash -c \"ffmpeg -i " + Configurations::file_name + " -vn mst-temp/audio/complete.aac -y\"";
       std::system(command.c_str());

       while(true)
       {
           // Define the actual video chunk (in seconds) to use, if EOF is reached, exit
           begin_chunk += (end_chunk - begin_chunk);
           if(begin_chunk == video_length)
               break;
           if(end_chunk + VIDEO_CHUNK <= video_length)
               end_chunk += VIDEO_CHUNK;
           else
               end_chunk += (video_length - end_chunk);

           // Set begin and end H, M, S variables
           begin_h = static_cast<int>(begin_chunk / 3600);
           begin_chunk -= (begin_h * 3600);
           begin_m = static_cast<int>(begin_chunk / 60);
           begin_chunk -= (begin_m * 60);
           begin_s = static_cast<int>(begin_chunk);
           end_h = static_cast<int>(end_chunk / 3600);
           end_chunk -= (end_h * 3600);
           end_m = static_cast<int>(end_chunk / 60);
           end_chunk -= (end_m * 60);
           end_s = static_cast<int>(end_chunk);

           // Extract bmp frames and audio from video chunk
           // Extract frames
           timing = " -ss " + std::to_string(begin_h) + ":" + std::to_string(begin_m) +
                   ":" + std::to_string(begin_s) + " -to " + std::to_string(end_h) +
                   ":" + std::to_string(end_m) + ":" + std::to_string(end_s);
           command = "bash -c \"ffmpeg -i " + Configurations::file_name + timing +
                   " -compression_algo raw -pix_fmt rgb24 mst-temp/frames/output%03d.bmp\"";
           std::system(command.c_str());
           // Extract audio
           command = "bash -c \"ffmpeg -i mst-temp/audio/complete.aac" + timing +
                   " -vn mst-temp/audio/audiochunk.aac -y\"";
           std::system(command.c_str());

           // Apply elaborations on audio and frames.........................

           // Write modified audio and frames to streaming pipes
           command = "bash -c \"cat mst-temp/audio/audiochunk.aac > mst-temp/mst_audio_pipe &amp; "
                     "cat mst-temp/frames/output*.bmp > mst-temp/mst_video_pipe\"";
           std::system(command.c_str());
       }
    }
    </int></int></int></int></int></int>
  • Unable to load FFProbe in laravel app

    1er août 2016, par Bullgod

    i have a problem when i upload a video with a form in my server. In the moment of upload, the aplication, must to convert the format of the video to mp4. In my notebook, this convertion work fine but when i try to convert a video in the server, i receive this error :

    ExecutableNotFoundException in FFProbeDriver.php line 50 : Unable to load FFProbe

    This is my form :

    {!! Form::open(['route' =>'upload.store', 'method'=>'POST', 'files'=> true ]) !!}

    <div class="form-group" style="display: none;">
       {!! Form::label('usuario_id', 'usuario_id:') !!}
       {!! Form::text('usuario_id', Auth::user()->id) !!}
    </div>
    <div class="form-group" style="display: none;">
       {!! Form::label('state', 'State:') !!}
       {!! Form::text('state', 0) !!}
    </div>
    <div class="form-group">
       {!! Form::label('asignatura_id', 'Asignatura:') !!}
       {!! Form::select('asignatura_id', $subject) !!}
    </div>
    <div class="form-group">
       {!! Form::label('name', 'Nombre:') !!}
       {!! Form::text('name', null, ['class'=> 'form-control', 'placeholder' => 'Ingresa el nombre de la pelicula']) !!}
    </div>
    <div class="form-group">
       {!! Form::label('language', 'Idioma:') !!}
       {!! Form::text('language', null, ['class'=> 'form-control', 'placeholder' => 'Ingresa la descripcion']) !!}
    </div><div class="form-group">
       {!! Form::label('creation_date', 'Fecha Creación:') !!}
       {!! Form::text('creation_date', null, ['class'=> 'form-control', 'placeholder' => 'Ingresa el nombre de la pelicula']) !!}
    </div>
    <div class="form-group">
       {!! Form::label('description', 'Descripcion:') !!}
       {!! Form::text('description', null, ['class'=> 'form-control', 'placeholder' => 'Ingresa la descripcion']) !!}
    </div>
    <div class="form-group">
       {!! Form::label('imageRef', 'Imagen:') !!}
       {!! Form::file('imageRef') !!}
    </div>

    <div class="form-group">
       {!! Form::label('url', 'Video:') !!}
       {!! Form::file('url') !!}
    </div>
       {!! Form::submit('Registrar',['class' =>'btn btn-primary']) !!}
       {!! Form::close() !!}

    The function in the model :

    public function setUrlAttribute($url){

           $this->attributes['url'] = 'old/'.Carbon::now()->second.$url->getClientOriginalName();
           $name = Carbon::now()->second.$url->getClientOriginalName();
           \Storage::disk('local')->put($name, \File::get($url));

           $file = pathinfo($name,PATHINFO_FILENAME);
           $extension = pathinfo($name,PATHINFO_EXTENSION);

           $ffmpeg = \FFMpeg\FFMpeg::create([
               'ffmpeg.binaries'  => '/usr/bin/ffmpeg.exe',
               'ffprobe.binaries' => '/usr/bin/ffprobe.exe',
               'timeout'          => 0, // The timeout for the underlying process
               'ffmpeg.threads'   => 12,   // The number of threads that FFMpeg should use

           ]);
           $video = $ffmpeg->open($url);
           $format = new FFMpeg\Format\Video\X264('libmp3lame', 'libx264');
           $format->on('progress', function ($video, $format, $percentage) {
               echo "$percentage % transcoded";
           });
           $format
           -> setKiloBitrate(1000)
           -> setAudioChannels(2)
           -> setAudioKiloBitrate(256);

           $video
           ->save($format, 'files/convert/'.$file.'.mp4');
           $this->attributes['url'] = $file.'.mp4';
       }

    if i convert the video in the console i receive this :

    # ffmpeg -i 67portrait.MOV -vcodec libx264 new.mp4
    FFmpeg version 0.6.5, Copyright (c) 2000-2010 the FFmpeg developers
     built on Jan 29 2012 17:52:15 with gcc 4.4.5 20110214 (Red Hat 4.4.5-6)
     configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --incdir=/usr/include --disable-avisynth --extra-cflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fPIC' --enable-avfilter --enable-avfilter-lavf --enable-libdc1394 --enable-libdirac --enable-libfaac --enable-libfaad --enable-libfaadbin --enable-libgsm --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libx264 --enable-gpl --enable-nonfree --enable-postproc --enable-pthreads --enable-shared --enable-swscale --enable-vdpau --enable-version3 --enable-x11grab
     libavutil     50.15. 1 / 50.15. 1
     libavcodec    52.72. 2 / 52.72. 2
     libavformat   52.64. 2 / 52.64. 2
     libavdevice   52. 2. 0 / 52. 2. 0
     libavfilter    1.19. 0 /  1.19. 0
     libswscale     0.11. 0 /  0.11. 0
     libpostproc   51. 2. 0 / 51. 2. 0

    Seems stream 1 codec frame rate differs from container frame rate: 1200.00 (1200/1) -> 29.97 (30000/1001)
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '67portrait.MOV':
     Metadata:
       major_brand     : qt  
       minor_version   : 0
       compatible_brands: qt  
       date            : 2013-11-29T13:19:09+0100
       date-fra        : 2013-11-29T13:19:09+0100
     Duration: 00:00:02.08, start: 0.000000, bitrate: 926 kb/s
       Stream #0.0(und): Audio: aac, 44100 Hz, mono, s16, 60 kb/s
       Stream #0.1(und): Video: h264, yuv420p, 568x320, 863 kb/s, 29.98 fps, 29.97 tbr, 600 tbn, 1200 tbc
    [libx264 @ 0x24bab70]broken ffmpeg default settings detected
    [libx264 @ 0x24bab70]use an encoding preset (e.g. -vpre medium)
    [libx264 @ 0x24bab70]preset usage: -vpre <speed> -vpre <profile>
    [libx264 @ 0x24bab70]speed presets are listed in x264 --help
    [libx264 @ 0x24bab70]profile is optional; x264 defaults to high
    Output #0, mp4, to 'new.mp4':
       Stream #0.0(und): Video: libx264, yuv420p, 568x320, q=2-31, 200 kb/s, 90k tbn, 29.97 tbc
       Stream #0.1(und): Audio: libfaac, 44100 Hz, mono, s16, 64 kb/s
    Stream mapping:
     Stream #0.1 -> #0.0
     Stream #0.0 -> #0.1
    Error while opening encoder for output stream #0.0 - maybe incorrect parameters such as bit_rate, rate, width or height
    </profile></speed>

    i have tried a lot of thinks to resolve this problem but steel happend.

  • ffmpeg GRAY16 stream over network

    28 novembre 2023, par Norbert P.

    Im working in a school project where we need to use depth cameras. The camera produces color and depth (in other words 16bit grayscale image). We decided to use ffmpeg, as later on compression could be very useful. For now we got some basic stream running form one PC to other. These settings include :

    &#xA;

      &#xA;
    • rtmp
    • &#xA;

    • flv as container
    • &#xA;

    • pixel format AV_PIX_FMT_YUV420P
    • &#xA;

    • codec AV_CODEC_ID_H264
    • &#xA;

    &#xA;

    The problem we are having is with grayscale image. Not every codec is able to cope with this format, so as not every protocol able to work with given codec. I got some settings "working" but receiver side is just stuck on avformat_open_input() method.&#xA;I have also tested it with commandline where ffmpeg is listening for connection and same happens.

    &#xA;

    I include a minimum "working" example of client code. Server can be tested with "ffmpeg.exe -f apng -listen 1 -i rtmp ://localhost:9999/stream/stream1 -c copy -f apng -listen 1 rtmp ://localhost:2222/live/l" or code below. I get no warnings, ffmpeg is newest version installed with "vcpkg install —triplet x64-windows ffmpeg[ffmpeg,ffprobe,zlib]" on windows or packet manager on linux.

    &#xA;

    The question : Did I miss something ? How do I get it to work ? If you have any better ideas I would very gladly consider them. In the end I need 16 bits of lossless transmission, could be split between channels etc. which I also tried with same effect.

    &#xA;

    Client code that would have camera and connect to server :

    &#xA;

    extern "C" {&#xA;#include <libavutil></libavutil>opt.h>&#xA;#include <libavcodec></libavcodec>avcodec.h>&#xA;#include <libavutil></libavutil>channel_layout.h>&#xA;#include <libavutil></libavutil>common.h>&#xA;#include <libavformat></libavformat>avformat.h>&#xA;#include <libavcodec></libavcodec>avcodec.h>&#xA;#include <libavutil></libavutil>imgutils.h>&#xA;}&#xA;&#xA;int main() {&#xA;&#xA;    std::string container = "apng";&#xA;    AVCodecID codec_id = AV_CODEC_ID_APNG;&#xA;    AVPixelFormat pixFormat = AV_PIX_FMT_GRAY16BE;&#xA;&#xA;    AVFormatContext* format_ctx;&#xA;    AVCodec* out_codec;&#xA;    AVStream* out_stream;&#xA;    AVCodecContext* out_codec_ctx;&#xA;    AVFrame* frame;&#xA;    uint8_t* data;&#xA;&#xA;    std::string server = "rtmp://localhost:9999/stream/stream1";&#xA;&#xA;    int width = 1280, height = 720, fps = 30, bitrate = 1000000;&#xA;&#xA;    //initialize format context for output with flv and no filename&#xA;    avformat_alloc_output_context2(&amp;format_ctx, nullptr, container.c_str(), server.c_str());&#xA;    if (!format_ctx) {&#xA;        return 1;&#xA;    }&#xA;&#xA;    //AVIOContext for accessing the resource indicated by url&#xA;    if (!(format_ctx->oformat->flags &amp; AVFMT_NOFILE)) {&#xA;        int avopen_ret = avio_open(&amp;format_ctx->pb, server.c_str(),&#xA;            AVIO_FLAG_WRITE);// , nullptr, nullptr);&#xA;        if (avopen_ret &lt; 0) {&#xA;            fprintf(stderr, "failed to open stream output context, stream will not work\n");&#xA;            return 1;&#xA;        }&#xA;    }&#xA;&#xA;&#xA;    const AVCodec* tmp_out_codec = avcodec_find_encoder(codec_id);&#xA;    //const AVCodec* tmp_out_codec = avcodec_find_encoder_by_name("hevc");&#xA;    out_codec = const_cast(tmp_out_codec);&#xA;    if (!(out_codec)) {&#xA;        fprintf(stderr, "Could not find encoder for &#x27;%s&#x27;\n",&#xA;            avcodec_get_name(codec_id));&#xA;&#xA;        return 1;&#xA;    }&#xA;&#xA;    out_stream = avformat_new_stream(format_ctx, out_codec);&#xA;    if (!out_stream) {&#xA;        fprintf(stderr, "Could not allocate stream\n");&#xA;        return 1;&#xA;    }&#xA;&#xA;    out_codec_ctx = avcodec_alloc_context3(out_codec);&#xA;&#xA;    const AVRational timebase = { 60000, fps };&#xA;    const AVRational dst_fps = { fps, 1 };&#xA;    av_log_set_level(AV_LOG_VERBOSE);&#xA;    //codec_ctx->codec_tag = 0;&#xA;    //codec_ctx->codec_id = codec_id;&#xA;    out_codec_ctx->codec_type = AVMEDIA_TYPE_VIDEO;&#xA;    out_codec_ctx->width = width;&#xA;    out_codec_ctx->height = height;&#xA;    out_codec_ctx->gop_size = 1;&#xA;    out_codec_ctx->time_base = timebase;&#xA;    out_codec_ctx->pix_fmt = pixFormat;&#xA;    out_codec_ctx->framerate = dst_fps;&#xA;    out_codec_ctx->time_base = av_inv_q(dst_fps);&#xA;    out_codec_ctx->bit_rate = bitrate;&#xA;    //if (fctx->oformat->flags &amp; AVFMT_GLOBALHEADER)&#xA;    //{&#xA;    //    codec_ctx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;&#xA;    //}&#xA;&#xA;    out_stream->time_base = out_codec_ctx->time_base; //will be set afterwards by avformat_write_header to 1/1000&#xA;&#xA;    int ret = avcodec_parameters_from_context(out_stream->codecpar, out_codec_ctx);&#xA;    if (ret &lt; 0)&#xA;    {&#xA;        fprintf(stderr, "Could not initialize stream codec parameters!\n");&#xA;        return 1;&#xA;    }&#xA;&#xA;    AVDictionary* codec_options = nullptr;&#xA;    av_dict_set(&amp;codec_options, "tune", "zerolatency", 0);&#xA;&#xA;    // open video encoder&#xA;    ret = avcodec_open2(out_codec_ctx, out_codec, &amp;codec_options);&#xA;    if (ret &lt; 0)&#xA;    {&#xA;        fprintf(stderr, "Could not open video encoder!\n");&#xA;        return 1;&#xA;    }&#xA;    av_dict_free(&amp;codec_options);&#xA;&#xA;    out_stream->codecpar->extradata_size = out_codec_ctx->extradata_size;&#xA;    out_stream->codecpar->extradata = static_cast(av_mallocz(out_codec_ctx->extradata_size));&#xA;    memcpy(out_stream->codecpar->extradata, out_codec_ctx->extradata, out_codec_ctx->extradata_size);&#xA;&#xA;    av_dump_format(format_ctx, 0, server.c_str(), 1);&#xA;&#xA;    frame = av_frame_alloc();&#xA;&#xA;    int sz = av_image_get_buffer_size(pixFormat, width, height, 32);&#xA;#ifdef _WIN32&#xA;    data = (uint8_t*)_aligned_malloc(sz, 32);&#xA;    if (data == NULL)&#xA;        return ENOMEM;&#xA;#else&#xA;    ret = posix_memalign(reinterpret_cast(&amp;data), 32, sz);&#xA;#endif&#xA;    av_image_fill_arrays(frame->data, frame->linesize, data, pixFormat, width, height, 32);&#xA;    frame->format = pixFormat;&#xA;    frame->width = width;&#xA;    frame->height = height;&#xA;    frame->pts = 1;&#xA;    if (avformat_write_header(format_ctx, nullptr) &lt; 0) //Header making problems!!!&#xA;    {&#xA;        fprintf(stderr, "Could not write header!\n");&#xA;        return 1;&#xA;    }&#xA;&#xA;    printf("stream time base = %d / %d \n", out_stream->time_base.num, out_stream->time_base.den);&#xA;&#xA;    double inv_stream_timebase = (double)out_stream->time_base.den / (double)out_stream->time_base.num;&#xA;    printf("Init OK\n");&#xA;    /*  Init phase end*/&#xA;    int dts = 0;&#xA;    int frameNo = 0;&#xA;&#xA;    while (true) {&#xA;        //Fill dummy frame with something&#xA;        for (int y = 0; y &lt; height; y&#x2B;&#x2B;) {&#xA;            uint16_t color = ((y &#x2B; frameNo) * 256) % (256 * 256);&#xA;            for (int x = 0; x &lt; width; x&#x2B;&#x2B;) {&#xA;                data[x&#x2B;y*width] = color;&#xA;            }&#xA;        }&#xA;&#xA;        memcpy(frame->data[0], data, 1280 * 720 * sizeof(uint16_t));&#xA;        AVPacket* pkt = av_packet_alloc();&#xA;&#xA;        int ret = avcodec_send_frame(out_codec_ctx, frame);&#xA;        if (ret &lt; 0)&#xA;        {&#xA;            fprintf(stderr, "Error sending frame to codec context!\n");&#xA;            return ret;&#xA;        }&#xA;        while (ret >= 0) {&#xA;            ret = avcodec_receive_packet(out_codec_ctx, pkt);&#xA;            if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)&#xA;                break;&#xA;            else if (ret &lt; 0) {&#xA;                fprintf(stderr, "Error during encoding\n");&#xA;                break;&#xA;            }&#xA;            pkt->dts = dts;&#xA;            pkt->pts = dts;&#xA;            dts &#x2B;= 33;&#xA;            av_write_frame(format_ctx, pkt);&#xA;            frameNo&#x2B;&#x2B;;&#xA;            av_packet_unref(pkt);&#xA;        }&#xA;        printf("Streamed %d frames\n", frameNo);&#xA;    }&#xA;    return 0;&#xA;}&#xA;

    &#xA;

    And part of server that should receive. code where is stops and waits

    &#xA;

    extern "C" {&#xA;#include <libavcodec></libavcodec>avcodec.h>&#xA;#include <libavformat></libavformat>avformat.h>&#xA;#include <libavformat></libavformat>avio.h>&#xA;}&#xA;&#xA;int main() {&#xA;    AVFormatContext* fmt_ctx = NULL;&#xA;    av_log_set_level(AV_LOG_VERBOSE);&#xA;    AVDictionary* options = nullptr;&#xA;    av_dict_set(&amp;options, "protocol_whitelist", "file,udp,rtp,tcp,rtmp,rtsp,hls", 0);&#xA;    av_dict_set(&amp;options, "timeout", "500000", 0); // Timeout in microseconds &#xA;&#xA;//Next Line hangs   &#xA;    int ret = avformat_open_input(&amp;fmt_ctx, "rtmp://localhost:9999/stream/stream1", NULL, &amp;options);&#xA;    if (ret != 0) {&#xA;        fprintf(stderr, "Could not open RTMP stream\n");&#xA;        return -1;&#xA;    }&#xA;&#xA;    // Find the first video stream&#xA;    ret = avformat_find_stream_info(fmt_ctx, nullptr);&#xA;    if (ret &lt; 0) {&#xA;        return ret;&#xA;    }&#xA;    //...&#xA;} &#xA;&#xA;

    &#xA;

    Edit :&#xA;I tried to just create a animated png and tried to stream that from the console to another console window to avoid any programming mistakes on my side. It was the same, I just could not get 16 PNG encoded stream to work. I hung trying to receive and closed when the file ended with in total zero frames received.

    &#xA;

    I managed to get other thing working :&#xA;To not encode gray frames with YUV420, I installed ffmpeg with libx264 support (was thinking is the same as H264, which in code is, but it adds support to new pixel formats). Used H264 again but with GRAY8 with doubled image width and reconstructing the image on the other side.

    &#xA;

    Maybe as a side note, I could not get any other formats to work. Is "flv" the only option here ? Could I get more performance if I changed it to... what ?

    &#xA;