[Libav-user] AV_CODEC_ID_SMPTE_KLV not recognized

Peter Ross pross at xvid.org
Fri Sep 5 15:30:15 CEST 2014


On Tue, Sep 02, 2014 at 10:33:46PM -0400, Timothy Reed wrote:
> I?m attempting to do the exact same thing and I too am stuck on the next step.  It appears to me that I will need to encode the KLV data into the packets but then how to mux them together?

Correct. FFmpeg has no 'KLV encoder'.
>
> Have you guys made any progress that you can share?

Before calling avformat_write_header(), you need to manually create a KLV stream.

  st = avformat_new_stream(s, NULL)
  st->id = _pick_a_number
  st->codec->codec_type = AVMEDIA_TYPE_DATA
  st->codec->codec_id = AV_CODEC_ID_SMPTE_KLV
  [...]
  avformat_write_header(s);

Then to output klv frame, you need to create an AVPacket and call av_write_frame()

  AVPacket pkt
  av_new_packet(&pkt, _data_size_)
  pkt.stream_index = _pick_a_number_
  // load klv data into pkt.data
  av_write_frame(s, &pkt)

Note everything above is untested pseudo code. You probably also need to set stream and packet pts.

-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20140905/1cd937d3/attachment.asc>


More information about the Libav-user mailing list