首页 > 解决方案 > 关于使用 ffmpeg 的输出文件名

问题描述

我一直在尝试保持输出文件名与输入文件名相同。代码看起来像


async def output_directory, total _ time, message ,chan_msg) :
 
out_put_file_name = output_directory + \ 
"/" + str(round(time.time())) + 
". mp4" 

progress = output_directory + "/" + "progress.txt" 
With open(progress, 'w') as f: 
pass 

file_genertor_command = 
"ffmpeg" , 
" -hide_banner " 
" -loglevel" , 
"quiet" , 
" -progress" 
progress , 
video file, 
"-map" , 
"-c:v", 
"libx265" 
" -pix_fmt" , 
"yuv420p" , 
"-preset" , 
"medium" , 
"800X480" , 
"32", 
"libopus" , 
"-profile:a" , 
"aac_he v2" , 
"-ac" , 
"30k" , 
"copy" , 
out_put file name, 
Done

我希望使用与输入文件名相同的名称对输出文件进行编码。正如预期的那样,在这里我将文件名作为时间戳。请建议如何完成

这段代码实际上是这个机器人的一部分。

标签: ffmpegtelegram-botvideo-compression

解决方案


推荐阅读