def convert_file_2_flv(_id): """ @todo: 把视频音频转为FLV格式 @param _id: 文件ID """ file_obj = get_file_by_id(_id) open("/tmp/tmp", "w").write(file_obj.get("content")) print "------------------king is king " os.system( "ffmpeg -i /tmp/tmp -y -ab 56\ -ar 22050 -b 500 -qscale 1 -s 320*240 /tmp/tmp.flv" ) stream = open("/tmp/tmp.flv").read() converd_id = add_file(stream, content_type="video/x-flv", filename=str(_id) + ".flv") remove_tmp_file() return str(converd_id)
def convert_file_2_flv(_id): """ @todo: 把视频音频转为FLV格式 @param _id: 文件ID """ file_obj = get_file_by_id(_id) open("/tmp/tmp", "w").write(file_obj.get("content")) print "------------------king is king " os.system("ffmpeg -i /tmp/tmp -y -ab 56\ -ar 22050 -b 500 -qscale 1 -s 320*240 /tmp/tmp.flv") stream = open("/tmp/tmp.flv").read() converd_id = add_file(stream, content_type="video/x-flv", filename=str(_id) + ".flv") remove_tmp_file() return str(converd_id)
def get_file(_id): return get_file_by_id(_id)