youtube-dl
youtube-dl copied to clipboard
Added flag to merge videos from a playlist into one continuous file
Example Use-Case
youtube-dl http://thecolbertreport.cc.com/full-episodes/wllm5p/april-30--2014---audra-mcdonald
Usually, this produces four videos, one for each segment of the show. However...
youtube-dl --concat http://thecolbertreport.cc.com/full-episodes/wllm5p/april-30--2014---audra-mcdonald
Will produce one continuous video for the show.
The concat parameter needs to be documented at the beginning of YoutubeDL.py.
Your current implementation doesn't work on Python 3, where there is a distinction between strings and bytes:
Traceback (most recent call last):
File ".\__main__.py", line 18, in <module>
youtube_dl.main()
File "C:\Users\Phoenix\Documents\GitHub\youtube-dl\youtube_dl\__init__.py", line 850, in main
_real_main(argv)
File "C:\Users\Phoenix\Documents\GitHub\youtube-dl\youtube_dl\__init__.py", line 840, in _real_main
retcode = ydl.download(all_urls)
File "C:\Users\Phoenix\Documents\GitHub\youtube-dl\youtube_dl\YoutubeDL.py", line 1065, in download
self.extract_info(url)
File "C:\Users\Phoenix\Documents\GitHub\youtube-dl\youtube_dl\YoutubeDL.py", line 527, in extract_info
return self.process_ie_result(ie_result, download, extra_info)
File "C:\Users\Phoenix\Documents\GitHub\youtube-dl\youtube_dl\YoutubeDL.py", line 672, in process_ie_result
self.post_process(filename, ie_result)
File "C:\Users\Phoenix\Documents\GitHub\youtube-dl\youtube_dl\YoutubeDL.py", line 1099, in post_process
keep_video_wish, new_info = pp.run(info)
File "C:\Users\Phoenix\Documents\GitHub\youtube-dl\youtube_dl\postprocessor\ffmpeg.py", line 511, in run
stdout, stderr = p.communicate(input=files_cmd)
File "C:\Python33\lib\subprocess.py", line 928, in communicate
stdout, stderr = self._communicate(input, endtime, timeout)
File "C:\Python33\lib\subprocess.py", line 1202, in _communicate
self.stdin.write(input)
TypeError: 'str' does not support the buffer interface
You really should just extend run_ffmpeg_multiple_files
rather than making your own.
You need to escape special characters (notably single quotes) in input filenames.
The --keep-video
option is ignored.
This is a duplicate of my own PR, #2723; not just in functionality, but also problems. You've got a good starting point (kudos on figuring out how to use the concat filter without writing a temp file), but you need to think of a lot more edge cases. What happens if the user requests multiple videos instead of a playlist? What if not every video uses the same codec? Are users going to know what the heck 'concat' means?
Go read some of the comments on my PR for some extra food for thought.
Thanks for the comments, I had no idea someone else was working on this.
The reason I made my own function was for the special concat filter. I didn't want to break anything using run_ffmpeg_multiple_files
. I'll look into merging them into one function.
For the filename encoding, encodeFilename should handle that, right? I called it, just forgot to use the encoded filename.
In regards to modifying run_ffmpeg_multiple_files
, see here.
encodeFilename
should do the right thing, but I had a few problems with it.
I had no idea someone else was working on this.
Yeah, that's because I haven't gotten off my lazy arse and finished it like I should have 3 weeks ago.
I can't seem to test with The Colbert Report anymore. Do you mind trying:
youtube-dl http://thecolbertreport.cc.com/videos/gh6urb/neil-degrasse-tyson-pt--1
(or any video from Comedy Central, for that matter)
Sure, trying it now.
If you have an IRC client, join #youtube-dl on Freenode for easier discussion.
Did this make it into the main branch?
-just curious, as I'm having limited success piping the output of youtube-dl to this appletv-script :) http://xyrion.org/appletv/ (well, passing it as a variable, more like :)
-and would love to use this feature :)
For now, perhaps I'm better off somehow getting the amount of playlist items and modifying the .pl script to play them in turn?
I'm confused. Is this happening?
youtube-dl: error: no such option: --concat