删除无用方法

This commit is contained in:
Jerry Yan 2025-03-28 17:30:28 +08:00
parent b25ad20ddd
commit 52c2df8b65

View File

@ -12,31 +12,6 @@ from telemetry import get_tracer
logger = logging.getLogger(__name__)
def to_annexb(file):
with get_tracer("ffmpeg").start_as_current_span("to_annexb") as span:
span.set_attribute("file.path", file)
if not os.path.exists(file):
span.set_status(Status(StatusCode.ERROR))
return file
logger.info("ToAnnexb: %s", file)
ffmpeg_process = subprocess.run(["ffmpeg", "-y", "-hide_banner", "-i", file,
*MUTE_AUDIO_INPUT,
"-map", "0:v", "-map", "1:a",
"-c:v", "copy", "-bsf:v", "h264_mp4toannexb", "-shortest",
"-c:a", "aac", "-b:a", "128k", "-ar", "48000", "-ac", "2",
"-f", "mpegts", file+".ts"])
span.set_attribute("ffmpeg.args", json.dumps(ffmpeg_process.args))
logger.info("ToAnnexb: %s, returned: %s", file, ffmpeg_process.returncode)
span.set_attribute("ffmpeg.code", ffmpeg_process.returncode)
if ffmpeg_process.returncode == 0:
span.set_status(Status(StatusCode.OK))
span.set_attribute("file.size", os.path.getsize(file+".ts"))
os.remove(file)
return file+".ts"
else:
span.set_status(Status(StatusCode.ERROR))
return file
def re_encode_and_annexb(file):
with get_tracer("ffmpeg").start_as_current_span("re_encode_and_annexb") as span:
span.set_attribute("file.path", file)