Skip to content

Instantly share code, notes, and snippets.

@Deali-Axy
Created January 31, 2025 04:21
Show Gist options
  • Save Deali-Axy/776cb5882c028a5c0b5d669ef7e52272 to your computer and use it in GitHub Desktop.
Save Deali-Axy/776cb5882c028a5c0b5d669ef7e52272 to your computer and use it in GitHub Desktop.
将ts视频转码成mp4
# 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