forked from crisschan/emma_tools
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvideo_change.py
More file actions
30 lines (25 loc) · 1011 Bytes
/
video_change.py
File metadata and controls
30 lines (25 loc) · 1011 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2019/5/17 8:59 AM
# @Author : Criss Chan
# @Site :
# @File : video_change_proprity.py
# @Software: PyCharm
# @instruction: 视频修改码率的,为创建各种不同测试使用的视频文件做准备
from pydub import AudioSegment
class VideoChange(object):
def __init__(self,video_path):
self.__video_path = video_path
self.change_frame_rate()
def change_frame_rate(self):
'''
z转换码率(到喜马拉雅可以识别)
:return: null
'''
# 读取音频文件,设置采样率<default=44100>
song = AudioSegment.from_mp3(self.__video_path).set_frame_rate(128050)
# 按32k的bitrate导出文件到指定路径,这里是直接覆盖原文件
song.export(self.__video_path, format='mp3', bitrate='64k')
if __name__ == '__main__':
VideoChange('奈飞持续交付实践探寻上.mp3')
VideoChange('奈飞持续交付实践探寻下.mp3')