Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
ERROR: FFmpeg cannot edit existing files in-place. #22023
Comments
|
Post complete source code of your script. |
|
@dstftw Please reopen class VideoExtraction:
def __init__(self, high_quality=False, post_processors=None, fragment_retries=5,
verbose=False):
if post_processors is None:
post_processors = [{"key": "FFmpegVideoConvertor", "preferedformat": "mp4"}]
if high_quality is True:
format = "bestvideo+bestaudio/best"
else:
format = "worst"
self.ydl_opts = {
"format": format,
"postprocessors": post_processors,
"keepvideo": True,
"fragment_retries": fragment_retries,
"nocheckcertificate": True,
"verbose": verbose
}
def get_video(self, link, download_archive, out_name, download=True, audio=False):
self.ydl_opts["outtmpl"] = os.path.join(download_archive, out_name)
opts = self.ydl_opts
opts["forcejson"] = True
opts["writeinfojson"] = True
if audio is True:
opts['postprocessors'].append({
'key': 'FFmpegExtractAudio',
'preferredcodec': 'wav',
})
with ydl.YoutubeDL(opts) as y:
y.extract_info(url=link, download=download)
downloader = VideoExtraction(high_quality=False, verbose=True)
downloader.get_video(
link="https://www.youtube.com/watch?v=polXDtvYXLU",
download_archive="/home/user/Desktop/EXAMPLEPROJECT",
out_name="WAPO-CW-Putin-Interview.mp4",
download=True,
audio=True,
) |
|
Do not hardcode extension in |
|
@dstftw What would an alternative look like? This is what I found a long time ago on StackOverflow. |
|
Read FAQ on output template. |
Checklist
Verbose log
Description
If the video is downloaded in mp4 format and the desired format is mp4, ffmpeg fails with the error "ERROR: FFmpeg cannot edit existing files in-place." I propose that this error be handled in the youtube-dl source code for the following reasons.
I am happy to handle the error and send a pull request. I wanted to open a dialogue first to be sure that this was something that would get merged if I proposed it.