copy frame_index
encoding setup
added rough pts counter
added CODEC_FLAG_GLOBAL_HEADER flag if needed