По какой-то причине прямо сейчас я получаю следующее исключение FFmpegInvalidCommand
Код: Выделить всё
Error splitting the argument list: Option not foundКод: Выделить всё
import os
import re
import sys
from pathlib import Path
from ffmpeg import FFmpeg, FFmpegFileNotFound, FFmpegInvalidCommand
#Project looks through a folder, checks all the files in there, then edits metadata (and filename)
#and returns a new file for each file inside the folder
video = 'Anime' #Movie/TVSeries/Anime/etc...
name = 'Sword Art Online (2012)'
extension = '.mkv'
season = '01'
episode = 1
try:
folder = r'D:\ServerTransfer\Update Server\%s\%s\S%s\\' % (video, name, season)
#Check current file names
print('Current names are: ')
res = os.listdir(folder)
print(res)
# episode increase by 1 in each iteration
# iterate all files from a directory
for file_name in os.listdir(folder):
# Construct old file name
source = folder + file_name
try:
title = ''
if episode < 100:
# Adding the season & episode #'s
destination = folder + name + '.S' + season + 'E0' + str(episode) + extension
title = name + '.S' + season + 'E0' + str(episode)
## elif episode < 100:
## # Adding the season & episode #'s
## destination = folder + name + '.S' + season + '.E0' + str(episode) + extension
else:
# Adding the season & episode #'s
destination = folder + name + '.S' + season + 'E' + str(episode) + extension
title = name + '.S' + season + 'E' + str(episode)
# Renaming the file
if file_name.endswith(extension):
ffmpeg = FFmpeg(executable=r'c:\FFmpeg\bin\ffmpeg.exe').option("y").input(source).output(destination,codec="copy",title=title)
ffmpeg.execute()
except FFmpegFileNotFound as exception:
print("An FFmpegFileNotFound exception has been occurred!")
print("- Message from ffmpeg:", exception.message)
print("- Arguments to execute ffmpeg:", exception.arguments)
except FFmpegInvalidCommand as exception:
print("An FFmpegInvalidCommand exception has been occurred!")
print("- Message from ffmpeg:", exception.message)
print("- Arguments to execute ffmpeg:", exception.arguments)
except Exception as err:
print(f'Unexptected {err=}, {type(err)=}')
raise
episode += 1
print('All Files Renamed')
print('New Names are')
# verify the result
res = os.listdir(folder)
print(res)
except OSError as err:
print('OS error:', err)
except Exception as err:
print(f'Unexptected {err=}, {type(err)=}')
raise
Код: Выделить всё
- Arguments to execute ffmpeg: ['c:\\FFmpeg\\bin\\ffmpeg.exe', '-y', '-i', 'D:\\ServerTransfer\\Update Server\\Anime\\Sword Art Online (2012)\\S01\\\\[Kosaka] Sword Art Online - 01 - The World of Swords (1080p AV1 10Bit BluRay OPUS) [73066623].mkv', '-codec', 'copy', '-title', 'Sword Art Online (2012).S01E01', 'D:\\ServerTransfer\\Update Server\\Anime\\Sword Art Online (2012)\\S01\\\\Sword Art Online (2012).S01E01.mkv']
Подробнее здесь: https://stackoverflow.com/questions/793 ... ument-list
Мобильная версия