code cleanup
encode returns a av.codec.Packet and add mux