Recherche avancée

Médias (0)

Mot : - Tags -/xmp

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (111)

  • MediaSPIP Core : La Configuration

    9 novembre 2010, par

    MediaSPIP Core fournit par défaut trois pages différentes de configuration (ces pages utilisent le plugin de configuration CFG pour fonctionner) : une page spécifique à la configuration générale du squelettes ; une page spécifique à la configuration de la page d’accueil du site ; une page spécifique à la configuration des secteurs ;
    Il fournit également une page supplémentaire qui n’apparait que lorsque certains plugins sont activés permettant de contrôler l’affichage et les fonctionnalités spécifiques (...)

  • Submit bugs and patches

    13 avril 2011

    Unfortunately a software is never perfect.
    If you think you have found a bug, report it using our ticket system. Please to help us to fix it by providing the following information : the browser you are using, including the exact version as precise an explanation as possible of the problem if possible, the steps taken resulting in the problem a link to the site / page in question
    If you think you have solved the bug, fill in a ticket and attach to it a corrective patch.
    You may also (...)

  • 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

Sur d’autres sites (4122)

  • FFMPEG encrypted HLS single file is unplayable

    17 septembre 2019, par 3bodyZZ

    i use this command to generate the byterange segments

    ffmpeg -i test.mp4 -hls_time 20 -hls_flags single_file -hls_key_info_file key_info out.m3u8
    here is the output m3u8

    #EXTM3U
    #EXT-X-VERSION:4
    #EXT-X-TARGETDURATION:24
    #EXT-X-MEDIA-SEQUENCE:0
    #EXT-X-KEY:METHOD=AES-128,URI="key.bin"
    #EXTINF:23.933333,
    #EXT-X-BYTERANGE:1016328@0
    out.ts
    #EXTINF:19.200000,
    #EXT-X-BYTERANGE:824192@1016328
    out.ts
    #EXTINF:16.866667,
    #EXT-X-BYTERANGE:714024@1840520
    out.ts
    #EXT-X-ENDLIST

    and it does output incorrect byte range m3u8 file that is unplayable, i have tried the multiple segments and it works just fine but i need the single file, any one knows how to fix this ?

    here is the logs from ffmpeg

    ffmpeg version N-94167-ga514244319 Copyright (c) 2000-2019 the FFmpeg developers
     built with gcc 9.1.1 (GCC) 20190621
     configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
     libavutil      56. 30.100 / 56. 30.100
     libavcodec     58. 53.101 / 58. 53.101
     libavformat    58. 28.101 / 58. 28.101
     libavdevice    58.  7.100 / 58.  7.100
     libavfilter     7. 56.100 /  7. 56.100
     libswscale      5.  4.101 /  5.  4.101
     libswresample   3.  4.100 /  3.  4.100
     libpostproc    55.  4.100 / 55.  4.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'ttt.mp4':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : Lavf56.40.101
     Duration: 00:01:00.16, start: 0.000000, bitrate: 227 kb/s
       Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p(tv, bt709), 480x320, 157 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
       Metadata:
         handler_name    : VideoHandler
       Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 64 kb/s (default)
       Metadata:
         handler_name    : SoundHandler
    Stream mapping:
     Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
     Stream #0:1 -> #0:1 (aac (native) -> aac (native))
    Press [q] to stop, [?] for help
    [libx264 @ 000001df1e25dd80] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
    [libx264 @ 000001df1e25dd80] profile Progressive High, level 2.1, 4:2:0, 8-bit
    [libx264 @ 000001df1e25dd80] 264 - core 157 r2970 5493be8 - H.264/MPEG-4 AVC codec - Copyleft 2003-2019 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
    [hls @ 000001df1e25ac80] Opening 'key_info' for reading
    [hls @ 000001df1e25ac80] Opening 'key.bin' for reading
    [hls @ 000001df1e25ac80] Opening 'crypto:out.ts' for writing
    Output #0, hls, to 'out.m3u8':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : Lavf58.28.101
       Stream #0:0(und): Video: h264 (libx264), yuv420p, 480x320, q=-1--1, 30 fps, 90k tbn, 30 tbc (default)
       Metadata:
         handler_name    : VideoHandler
         encoder         : Lavc58.53.101 libx264
       Side data:
         cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
       Stream #0:1(und): Audio: aac (LC), 44100 Hz, stereo, fltp, 128 kb/s (default)
       Metadata:
         handler_name    : SoundHandler
         encoder         : Lavc58.53.101 aac
    [hls @ 000001df1e25ac80] Opening 'out.m3u8.tmp' for writinge=N/A speed=25.4x
    [hls @ 000001df1e25ac80] Opening 'out.m3u8.tmp' for writinge=N/A speed=23.8x
    [hls @ 000001df1e25ac80] Opening 'out.m3u8.tmp' for writinge=N/A speed=23.7x
    frame= 1800 fps=723 q=-1.0 Lsize=N/A time=00:01:00.11 bitrate=N/A speed=24.1x
    video:1196kB audio:947kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
    [libx264 @ 000001df1e25dd80] frame I:25    Avg QP:18.20  size: 18883
    [libx264 @ 000001df1e25dd80] frame P:524   Avg QP:21.64  size:  1174
    [libx264 @ 000001df1e25dd80] frame B:1251  Avg QP:30.70  size:   109
    [libx264 @ 000001df1e25dd80] consecutive B-frames:  4.2%  7.6%  5.8% 82.4%
    [libx264 @ 000001df1e25dd80] mb I  I16..4: 29.1%  8.6% 62.3%
    [libx264 @ 000001df1e25dd80] mb P  I16..4:  1.1%  0.8%  1.1%  P16..4: 14.6%  3.7%  2.2%  0.0%  0.0%    skip:76.5%
    [libx264 @ 000001df1e25dd80] mb B  I16..4:  0.0%  0.0%  0.1%  B16..8:  7.1%  0.5%  0.1%  direct: 0.2%  skip:92.0%  L0:47.1% L1:51.6% BI: 1.3%
    [libx264 @ 000001df1e25dd80] 8x8 transform intra:15.8% inter:36.0%
    [libx264 @ 000001df1e25dd80] coded y,uvDC,uvAC intra: 47.5% 75.5% 54.9% inter: 1.7% 4.4% 0.7%
    [libx264 @ 000001df1e25dd80] i16 v,h,dc,p: 48% 45%  5%  2%
    [libx264 @ 000001df1e25dd80] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 21% 20% 48%  2%  2%  1%  2%  2%  3%
    [libx264 @ 000001df1e25dd80] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 26% 27% 12%  7%  6%  5%  6%  5%  6%
    [libx264 @ 000001df1e25dd80] i8c dc,h,v,p: 34% 37% 21%  7%
    [libx264 @ 000001df1e25dd80] Weighted P-Frames: Y:0.0% UV:0.0%
    [libx264 @ 000001df1e25dd80] ref P L0: 83.5%  4.4%  9.5%  2.6%
    [libx264 @ 000001df1e25dd80] ref B L0: 90.1%  8.9%  1.0%
    [libx264 @ 000001df1e25dd80] ref B L1: 95.4%  4.6%
    [libx264 @ 000001df1e25dd80] kb/s:163.19
    [aac @ 000001df1e2138c0] Qavg: 357.178

    i have also tried different videos, and i have tried ffmpeg on windows and linux , i have tried compiling it myself and nothing seems to work the segments keeps repeating after reaching a certain point in the video

  • Encoding images to h264 and rtp output : SDP file without sprop-parameter-sets does not play

    14 septembre 2021, par oarfish

    tl ;dr : I try to encode acquired camera frames to h264, send via RTP
and play this back on another device. SDP file generated by ffmpeg for
a sample video has info which my own SDP file misses. My SDP file
plays in ffplay, but not VLC, while both play ffmpeg's SDP file. I am
suspecting missing sprop-parameter-sets in my SDP file.

    


    Ultimately I want to play this back in VLC.

    



    


    I am writing code that encodes images to h264 and outputs to an RTP
server (or client ? anyway the part that is listening). I generate an
SDP file for this.

    


      

    • ffplay plays the stream without problem
    • 


    • mplayer shows a green box embedded in a larger black box, but I read
somewhere it only supports mpegts over RTP, so not sure
    • 


    • VLC does not play the SDP file.
    • 


    


    Now when instead I use some random video and have ffmpeg output an SDP
file like so

    


    ffmpeg     -re     -i some.mp4     -an     -c:v copy -f rtp -sdp_file
video.sdp     "rtp://127.0.0.1:5004"


    


    I can see that the generated SDP file – which plays in both ffplay and
VLC – includes the base64 encoded sprop-parameter-sets field, and
removing this causes the stream to not play.

    


    > cat video.sdp
v=0
o=- 0 0 IN IP4 127.0.0.1
s=No Name
c=IN IP4 127.0.0.1
t=0 0
a=tool:libavformat 58.76.100
m=video 5004 RTP/AVP 96
b=AS:1034
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1;
sprop-parameter-sets=Z2QANKzZQDAA7fiMBagICAoAAAMAAgAAAwDwHjBjLA==,aOvjyyLA;
profile-level-id=640034


    


    My own SDP file on the other hand, does not contain this information,
and VLC hangs for 10s and then stops trying with "no data received".

    


    > cat test.sdp
v=0
o=- 0 0 IN IP4 127.0.0.1
s=No Name
c=IN IP4 127.0.0.1
t=0 0
a=tool:libavformat 58.76.100
m=video 44499 RTP/AVP 96
b=AS:2000
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1


    


    So my theory is that my custom code must somehow add this SPS
information to the SDP file. But despite hours of searching, I could
not find a structured way to set the extradata field on the AVStream's
AVCodecParams. The code I'm using is roughly this (I'm sure there's
unrelated errors in there) :

    


    // variables&#xA;std::vector imgbuf;&#xA;AVFormatContext *ofmt_ctx = nullptr;&#xA;AVCodec *out_codec = nullptr;&#xA;AVStream *out_stream = nullptr;&#xA;AVCodecContext *out_codec_ctx = nullptr;&#xA;SwsContext *swsctx = nullptr;&#xA;cv::Mat canvas_;&#xA;unsigned int height_;&#xA;unsigned int width_;&#xA;unsigned int fps_;&#xA;AVFrame *frame_ = nullptr;&#xA;&#xA;AVOutputFormat *format = av_guess_format("rtp", nullptr, nullptr);&#xA;const auto url = std::string("rtp://127.0.0.1:5001");&#xA;avformat_alloc_output_context2(ofmt_ctx, format, format->name, url.c_str());&#xA;&#xA;out_codec = avcodec_find_encoder(AV_CODEC_ID_H264);&#xA;stream = avformat_new_stream(ofmt_ctx, out_codec);&#xA;out_codec_ctx = avcodec_alloc_context3(out_codec);&#xA;&#xA;// then, for each incoming image:&#xA;while (receive_image) {&#xA;  static bool first_time = true;&#xA;  if (first_time) {&#xA;    // discover necessary params such as image dimensions from the first&#xA;    // received image&#xA;    first_time = false;&#xA;    height_ = image.rows;&#xA;    width_ = image.cols;&#xA;&#xA;    codec_ctx->codec_tag = 0;&#xA;    codec_ctx->bit_rate = 2e6;&#xA;    // does nothing, unfortunately&#xA;    codec_ctx->thread_count = 1;&#xA;    codec_ctx->codec_id = AV_CODEC_ID_H264;&#xA;    codec_ctx->codec_type = AVMEDIA_TYPE_VIDEO;&#xA;    codec_ctx->width = width_;&#xA;    codec_ctx->height = height_;&#xA;    codec_ctx->gop_size = 6;&#xA;    codec_ctx->pix_fmt = AV_PIX_FMT_YUV420P;&#xA;    codec_ctx->framerate = fps_;&#xA;    codec_ctx->time_base = av_inv_q(fps_);&#xA;&#xA;    avcodec_parameters_from_context(stream, out_codec_ctx);&#xA;&#xA;    // this stuff is empty: is that the problem?&#xA;    stream->codecpar->extradata = codec_ctx->extradata;&#xA;    stream->codecpar->extradata_size = codec_ctx->extradata_size;&#xA;&#xA;    AVDictionary *codec_options = nullptr;&#xA;    av_dict_set(&amp;codec_options, "profile", "high", 0);&#xA;    av_dict_set(&amp;codec_options, "preset", "ultrafast", 0);&#xA;    av_dict_set(&amp;codec_options, "tune", "zerolatency", 0);&#xA;&#xA;    // open video encoder&#xA;    avcodec_open2(codec_ctx, codec, &amp;codec_options);&#xA;&#xA;    stream->time_base.num = 1;&#xA;    stream->time_base.den = fps_;&#xA;    avio_open(&amp;(ofmt_ctx->pb), ofmt_ctx->filename, AVIO_FLAG_WRITE);&#xA;&#xA;    /* Write a file for VLC */&#xA;    char buf[200000];&#xA;    AVFormatContext *ac[] = {ofmt_ctx};&#xA;    av_sdp_create(ac, 1, buf, 20000);&#xA;    printf("sdp:\n%s\n", buf);&#xA;    FILE *fsdp = fopen("test.sdp", "w");&#xA;    fprintf(fsdp, "%s", buf);&#xA;    fclose(fsdp);&#xA;&#xA;    swsctx = sws_getContext(width_, height_, AV_PIX_FMT_BGR24, width_, height_,&#xA;                            out_codec_ctx->pix_fmt, SWS_BICUBIC, nullptr,&#xA;                            nullptr, nullptr);&#xA;  }&#xA;&#xA;  if (!frame_) {&#xA;    frame_ = av_frame_alloc();&#xA;&#xA;    std::uint8_t *framebuf = new uint8_t[av_image_get_buffer_size(&#xA;        codec_ctx->pix_fmt, width_, height_, 1)];&#xA;    av_image_fill_arrays(frame_->data, frame_->linesize, framebuf,&#xA;                         codec_ctx->pix_fmt, width, height, 1);&#xA;    frame_->width = width_;&#xA;    frame_->height = height_;&#xA;    frame_->format = static_cast<int>(codec_ctx->pix_fmt);&#xA;    success = avformat_write_header(ofmt_ctx, nullptr);&#xA;  }&#xA;  if (imgbuf.empty()) {&#xA;    imgbuf.resize(height_ * width_ * 3 &#x2B; 16);&#xA;    canvas_ = cv::Mat(height_, width_, CV_8UC3, imgbuf.data(), width_ * 3);&#xA;  } else {&#xA;    image.copyTo(canvas_);&#xA;  }&#xA;&#xA;  const int stride[] = {static_cast<int>(image.step[0])};&#xA;&#xA;  sws_scale(swsctx, &amp;canvas_.data, stride, 0, canvas_.rows, frame_->data,&#xA;            frame_->linesize);&#xA;  frame_->pts &#x2B;= av_rescale_q(1, out_codec_ctx->time_base, stream->time_base);&#xA;&#xA;  AVPacket pkt = {0};&#xA;  avcodec_send_frame(out_codec_ctx, frame_);&#xA;  avcodec_receive_packet(out_codec_ctx, &amp;pkt);&#xA;  av_interleaved_write_frame(ofmt_ctx, &amp;pkt);&#xA;}&#xA;</int></int>

    &#xA;

    Can anyone offer some advice here ?

    &#xA;

    &#xA;

    Update

    &#xA;

    When setting

    &#xA;

    this->out_codec_ctx->flags |=AV_CODEC_FLAG_GLOBAL_HEADER;&#xA;

    &#xA;

    extradata is actually present in the codec context, but I had to move avcodec_parameters_from_context() after avcodec_open2(), as the extradata is empty before opening the codec. I now get sprop-parameter-sets in the SDP file, but VLC still does not play it.

    &#xA;

  • Encoding images to h264 and rtp output : SDP file without sprop-parameter-sets does not play

    14 septembre 2021, par oarfish

    tl ;dr : I try to encode acquired camera frames to h264, send via RTP&#xA;and play this back on another device. SDP file generated by ffmpeg for&#xA;a sample video has info which my own SDP file misses. My SDP file&#xA;plays in ffplay, but not VLC, while both play ffmpeg's SDP file. I am&#xA;suspecting missing sprop-parameter-sets in my SDP file.

    &#xA;

    Ultimately I want to play this back in VLC.

    &#xA;


    &#xA;

    I am writing code that encodes images to h264 and outputs to an RTP&#xA;server (or client ? anyway the part that is listening). I generate an&#xA;SDP file for this.

    &#xA;

      &#xA;
    • ffplay plays the stream without problem
    • &#xA;

    • mplayer shows a green box embedded in a larger black box, but I read&#xA;somewhere it only supports mpegts over RTP, so not sure
    • &#xA;

    • VLC does not play the SDP file.
    • &#xA;

    &#xA;

    Now when instead I use some random video and have ffmpeg output an SDP&#xA;file like so

    &#xA;

    ffmpeg     -re     -i some.mp4     -an     -c:v copy -f rtp -sdp_file&#xA;video.sdp     "rtp://127.0.0.1:5004"&#xA;

    &#xA;

    I can see that the generated SDP file – which plays in both ffplay and&#xA;VLC – includes the base64 encoded sprop-parameter-sets field, and&#xA;removing this causes the stream to not play.

    &#xA;

    > cat video.sdp&#xA;v=0&#xA;o=- 0 0 IN IP4 127.0.0.1&#xA;s=No Name&#xA;c=IN IP4 127.0.0.1&#xA;t=0 0&#xA;a=tool:libavformat 58.76.100&#xA;m=video 5004 RTP/AVP 96&#xA;b=AS:1034&#xA;a=rtpmap:96 H264/90000&#xA;a=fmtp:96 packetization-mode=1;&#xA;sprop-parameter-sets=Z2QANKzZQDAA7fiMBagICAoAAAMAAgAAAwDwHjBjLA==,aOvjyyLA;&#xA;profile-level-id=640034&#xA;

    &#xA;

    My own SDP file on the other hand, does not contain this information,&#xA;and VLC hangs for 10s and then stops trying with "no data received".

    &#xA;

    > cat test.sdp&#xA;v=0&#xA;o=- 0 0 IN IP4 127.0.0.1&#xA;s=No Name&#xA;c=IN IP4 127.0.0.1&#xA;t=0 0&#xA;a=tool:libavformat 58.76.100&#xA;m=video 44499 RTP/AVP 96&#xA;b=AS:2000&#xA;a=rtpmap:96 H264/90000&#xA;a=fmtp:96 packetization-mode=1&#xA;

    &#xA;

    So my theory is that my custom code must somehow add this SPS&#xA;information to the SDP file. But despite hours of searching, I could&#xA;not find a structured way to set the extradata field on the AVStream's&#xA;AVCodecParams. The code I'm using is roughly this (I'm sure there's&#xA;unrelated errors in there) :

    &#xA;

    // variables&#xA;std::vector imgbuf;&#xA;AVFormatContext *ofmt_ctx = nullptr;&#xA;AVCodec *out_codec = nullptr;&#xA;AVStream *out_stream = nullptr;&#xA;AVCodecContext *out_codec_ctx = nullptr;&#xA;SwsContext *swsctx = nullptr;&#xA;cv::Mat canvas_;&#xA;unsigned int height_;&#xA;unsigned int width_;&#xA;unsigned int fps_;&#xA;AVFrame *frame_ = nullptr;&#xA;&#xA;AVOutputFormat *format = av_guess_format("rtp", nullptr, nullptr);&#xA;const auto url = std::string("rtp://127.0.0.1:5001");&#xA;avformat_alloc_output_context2(ofmt_ctx, format, format->name, url.c_str());&#xA;&#xA;out_codec = avcodec_find_encoder(AV_CODEC_ID_H264);&#xA;stream = avformat_new_stream(ofmt_ctx, out_codec);&#xA;out_codec_ctx = avcodec_alloc_context3(out_codec);&#xA;&#xA;// then, for each incoming image:&#xA;while (receive_image) {&#xA;  static bool first_time = true;&#xA;  if (first_time) {&#xA;    // discover necessary params such as image dimensions from the first&#xA;    // received image&#xA;    first_time = false;&#xA;    height_ = image.rows;&#xA;    width_ = image.cols;&#xA;&#xA;    codec_ctx->codec_tag = 0;&#xA;    codec_ctx->bit_rate = 2e6;&#xA;    // does nothing, unfortunately&#xA;    codec_ctx->thread_count = 1;&#xA;    codec_ctx->codec_id = AV_CODEC_ID_H264;&#xA;    codec_ctx->codec_type = AVMEDIA_TYPE_VIDEO;&#xA;    codec_ctx->width = width_;&#xA;    codec_ctx->height = height_;&#xA;    codec_ctx->gop_size = 6;&#xA;    codec_ctx->pix_fmt = AV_PIX_FMT_YUV420P;&#xA;    codec_ctx->framerate = fps_;&#xA;    codec_ctx->time_base = av_inv_q(fps_);&#xA;&#xA;    avcodec_parameters_from_context(stream, out_codec_ctx);&#xA;&#xA;    // this stuff is empty: is that the problem?&#xA;    stream->codecpar->extradata = codec_ctx->extradata;&#xA;    stream->codecpar->extradata_size = codec_ctx->extradata_size;&#xA;&#xA;    AVDictionary *codec_options = nullptr;&#xA;    av_dict_set(&amp;codec_options, "profile", "high", 0);&#xA;    av_dict_set(&amp;codec_options, "preset", "ultrafast", 0);&#xA;    av_dict_set(&amp;codec_options, "tune", "zerolatency", 0);&#xA;&#xA;    // open video encoder&#xA;    avcodec_open2(codec_ctx, codec, &amp;codec_options);&#xA;&#xA;    stream->time_base.num = 1;&#xA;    stream->time_base.den = fps_;&#xA;    avio_open(&amp;(ofmt_ctx->pb), ofmt_ctx->filename, AVIO_FLAG_WRITE);&#xA;&#xA;    /* Write a file for VLC */&#xA;    char buf[200000];&#xA;    AVFormatContext *ac[] = {ofmt_ctx};&#xA;    av_sdp_create(ac, 1, buf, 20000);&#xA;    printf("sdp:\n%s\n", buf);&#xA;    FILE *fsdp = fopen("test.sdp", "w");&#xA;    fprintf(fsdp, "%s", buf);&#xA;    fclose(fsdp);&#xA;&#xA;    swsctx = sws_getContext(width_, height_, AV_PIX_FMT_BGR24, width_, height_,&#xA;                            out_codec_ctx->pix_fmt, SWS_BICUBIC, nullptr,&#xA;                            nullptr, nullptr);&#xA;  }&#xA;&#xA;  if (!frame_) {&#xA;    frame_ = av_frame_alloc();&#xA;&#xA;    std::uint8_t *framebuf = new uint8_t[av_image_get_buffer_size(&#xA;        codec_ctx->pix_fmt, width_, height_, 1)];&#xA;    av_image_fill_arrays(frame_->data, frame_->linesize, framebuf,&#xA;                         codec_ctx->pix_fmt, width, height, 1);&#xA;    frame_->width = width_;&#xA;    frame_->height = height_;&#xA;    frame_->format = static_cast<int>(codec_ctx->pix_fmt);&#xA;    success = avformat_write_header(ofmt_ctx, nullptr);&#xA;  }&#xA;  if (imgbuf.empty()) {&#xA;    imgbuf.resize(height_ * width_ * 3 &#x2B; 16);&#xA;    canvas_ = cv::Mat(height_, width_, CV_8UC3, imgbuf.data(), width_ * 3);&#xA;  } else {&#xA;    image.copyTo(canvas_);&#xA;  }&#xA;&#xA;  const int stride[] = {static_cast<int>(image.step[0])};&#xA;&#xA;  sws_scale(swsctx, &amp;canvas_.data, stride, 0, canvas_.rows, frame_->data,&#xA;            frame_->linesize);&#xA;  frame_->pts &#x2B;= av_rescale_q(1, out_codec_ctx->time_base, stream->time_base);&#xA;&#xA;  AVPacket pkt = {0};&#xA;  avcodec_send_frame(out_codec_ctx, frame_);&#xA;  avcodec_receive_packet(out_codec_ctx, &amp;pkt);&#xA;  av_interleaved_write_frame(ofmt_ctx, &amp;pkt);&#xA;}&#xA;</int></int>

    &#xA;

    Can anyone offer some advice here ?

    &#xA;

    &#xA;

    Update

    &#xA;

    When setting

    &#xA;

    this->out_codec_ctx->flags |=AV_CODEC_FLAG_GLOBAL_HEADER;&#xA;

    &#xA;

    extradata is actually present in the codec context, but I had to move avcodec_parameters_from_context() after avcodec_open2(), as the extradata is empty before opening the codec. I now get sprop-parameter-sets in the SDP file, but VLC still does not play it.

    &#xA;