[Libav-user] AV_CODEC_ID_SMPTE_KLV not recognized

Timothy Reed treed at what4software.com
Fri Sep 5 15:47:09 CEST 2014


Great thanks.   The first part was what I was missing regarding the header. I figured out the packet stuff yesterday.  Now to carefully package the data in the packet for writing to the file.  


Sent from my iPhone

> On Sep 5, 2014, at 9:30, Peter Ross <pross at xvid.org> wrote:
> 
>> 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)
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user


More information about the Libav-user mailing list