Created
January 31, 2025 04:21
-
-
Save Deali-Axy/776cb5882c028a5c0b5d669ef7e52272 to your computer and use it in GitHub Desktop.
将ts视频转码成mp4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ts转码成mp4 | |
from http.server import executable | |
import os | |
import ffmpy | |
for file in os.listdir('.'): | |
if file.endswith('ts'): | |
print(f'处理文件:{file}') | |
new_file = file[:-3] + '.mp4' | |
ff = ffmpy.FFmpeg( | |
#executable='/opt/ffmpeg/ffmpeg', | |
inputs={file: None}, | |
outputs={new_file: '-c copy'} | |
) | |
print(ff.cmd) | |
ff.run() | |
# print(f'删除:{file}') | |
# os.remove(file) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment