Skip to content

Instantly share code, notes, and snippets.

@ps173
ps173 / converter.py
Last active May 4, 2021 16:19
A converter for webm format (requires ffmpeg)
#-*- coding:utf-8 -*-
# Webm converter for audio streams and video streams (can only convert audio to audio and video to video)
import subprocess
import sys
def convert_to_audio(filename):
command = ['ffmpeg', '-i', filename , 'out.mp3']
subprocess.run(command,stdout=subprocess.PIPE,stdin=subprocess.PIPE)