기억기억

heyme·2023년 5월 31일

아진짜뭐였지
작년에 왜 이 옵션을 줬었는지 기억이 안난다.
역시 다 적어놔야 하는데 내 기억을 믿었나보다.
하지만 나는 기억이 안난다. 이번엔 적어놔야지

def extract_wav(in_file, out_file, sr):

save_path_ts = f'{out_file}/{os.path.basename(in_file)[:-3]}.wav'
save_path_mp4 = f'{out_file}/{os.path.basename(in_file)[:-4]}.wav'

_, type_ = os.path.splitext(in_file)
if type_ == '.mp4' or type_ == '.wav':
    command = f'ffmpeg -y -i {in_file} -vn -acodec pcm_s16le -ac 2 -ar {sr} {save_path_mp4}'
elif type_ == '.ts':
    command = f'ffmpeg -y -i {in_file} -vn -acodec pcm_s16le -ac 2 -ar {sr} {save_path_ts}'

#print(f'Running command: {command}')
process = subprocess.Popen( #-------------------->> subprocess.run으로 변경//속도느려짐
    #shlex.split(command),
    shlex.split(f'ffmpeg -y -i {in_file} -vn -acodec pcm_s16le -ac 2 -ar {sr} {save_path_mp4}' if (type_=='.mp4' or type_ =='.wav') else f'ffmpeg -y -i {in_file} -vn -acodec pcm_s16le -ac 2 -ar {sr} {save_path_ts}'),
    stdout = subprocess.PIPE,
    stderr = subprocess.STDOUT,
    #universal_newlines = True,
    #shell = True      #------------------------->> dont use
    #timeout = 300
)
'''
stdout, stderr = process.communicate()
print('STDOUT:', stdout)
print('STDERR:', stderr)
if process.returncode != 0:
    print('Error occured in ffmpeg')
'''

그런데 이렇게 하고나면 터미널 작동이 안됨. why is that?
reset!!!!!!!!!! shell 초기화하기

4개의 댓글

comment-user-thumbnail
2023년 6월 7일

일기써라 일기!!!!
뷰유유유유유융

답글 달기
comment-user-thumbnail
2023년 6월 7일

왜 작동이 안되겠냐!!!
뷰유유유유유유유융

1개의 답글
comment-user-thumbnail
2023년 6월 29일

작동이 왜 안되는지 500자 이내로 서술하시오
(이유에 본인의 잘못을 400자 이상 쓰시오)

답글 달기