Zend certified PHP/Magento developer

FFMPEG encode interlaced frames

I try to encode incoming frames using FFMPEG to h264 and write it to an SD card. I get the raw frames as memory buffers from hardware and then use the FFMPEG C API to encode those. Encoding is running. However, the interlaced nature of the frames is not correct.
I have 480i input video, but the output file is 720×240 “progressive”, that is, the frames are consecutive and VLC is not deinterlacing. It seems I missed a step somewhere to tell either the output container or x264 that the video is a series of interlaced frames. My initialisation so far:

if(framebuffer->videoMode == XVIDC_VM_720x480_60_I){
    framebuffer->context->width = 720;
    framebuffer->context->height = 240;//240
    /* frames per second */
    framebuffer->context->time_base = (AVRational){1, 60};
    framebuffer->context->framerate = (AVRational){60, 1};
} else {//if(videoMode == XVIDC_VM_720x576_50_P){
    framebuffer->context->width = 720;
    framebuffer->context->height = 288;//288
    /* frames per second */
    framebuffer->context->time_base = (AVRational){1, 50};
    framebuffer->context->framerate = (AVRational){50, 1};
}
av_dict_set( &opt, "preset", "ultrafast", 0 );
av_dict_set( &opt, "x264opts", "interlaced=1", 0 );//
av_dict_set( &opt, "movflags", "frag_keyframe", 0 );//
av_dict_set( &opt, "flags", "+ildct+ilme", 0 );
framebuffer->context->flags |= AV_CODEC_FLAG_INTERLACED_DCT ;
framebuffer->context->flags2 |= AV_CODEC_FLAG2_FAST ;

As far as I could search in a terminal call to FFMPEG specifying -flags +ildct+ilme should be sufficient, but no combination of the aforementioned flags together with other flags aimed at x264 worked for me.
Is there something in the AVFrames I have to set to indicate the interlaced nature of the frames?