[FFmpeg-devel] Stream description

Francesco, Cuzzocrea francesco at bltitalia.com
Wed Feb 21 19:37:31 EET 2018


Hi to all

I'm writing a module for ffmpeg that demuxes custom file format. Up to 
now audio is ok but I haven't figured out how

to describe video.  Our format is jpeg2000 4:2:2 stored on file as per 
field, that is there is filed0 codestream and field 1

codestream for each frame. This is the description I made for video stream:

     // Add video stream
     v_st = avformat_new_stream(cblt->fc, NULL);
     if (!v_st) {
             av_log(cblt->fc, AV_LOG_ERROR, "could not allocate video 
stream\n");
             ret = AVERROR(ENOMEM);
             goto fail_and_free;
     }

     v_st->index = 0;    v_st->id = 0;

    v_st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
     v_st->codecpar->width = 1920;

    v_st->codecpar->codec_id = AV_CODEC_ID_JPEG2000;
     v_st->codecpar->format = AV_PIX_FMT_YUV422P;
     v_st->codecpar->height = 540; /* Field height, not frame height */
     v_st->codecpar->field_order = AV_FIELD_TB;
     v_st->time_base.num = 1; v_st->time_base.den = 25;
     v_st->avg_frame_rate.num = 25; v_st->avg_frame_rate.den = 1;

     v_st->duration = 75 ; // Clip is of 3 seconds => 75 frames
     v_st->start_time = 0;
     v_st->nb_frames = 75;
     v_st->sample_aspect_ratio.num = 4; v_st->sample_aspect_ratio.den = 3;

With this description only field 0 is decoded.  If in the 
blt_read_packet function

I insert field 0 codestream and field 1 codestream, in the Packet data 
buffer, I receive an error.

How can I describe my stream as per field ?

regards

-- 
/*******************************************************************\
*    Ing. Francesco  Cuzzocrea
*    company:    BLT Italia srl        web:  http://www.blt.it
*    address:    via Rosselli, 91     city:  Lido di CAMAIORE
*    country:    ITALY                 zip:  55043-i
*      Tel. :    +39 0584 904788       Fax:  +39 0584 904789
*     e-mail:   francesco at bltitalia.com
\*******************************************************************/
--  BLT will be at BVE2018 (27 Feb ~ 1 Mar 2018)  -  Booth  H18   --



More information about the ffmpeg-devel mailing list