Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

> > > Other solution could work well on cmd and python code: (updated from [#622 (comment)](https://github.com/ytdl-org/youtube-dl/issues/622#issuecomment-162337869)) #25402

Closed
windspirit95 opened this issue May 25, 2020 · 2 comments

Comments

@windspirit95
Copy link

@windspirit95 windspirit95 commented May 25, 2020

Other solution could work well on cmd and python code: (updated from #622 (comment))
powershell.exe ffmpeg -ss 3 -i $(youtube-dl -f mp4 -g "https://www.youtube.com/watch?v=--0NTAs-fA0") -t 15 -c copy react-spot.mp4
Sample python code for autodownload from csv file:
image
The subprocess.check_output will run the command in Anaconda cmd (As I run this python code in Anaconda cmd) without a popup additional command window, as far as I know.

nice work, sounds good. could you please write a little guide on how to use it?

In my case, I have to read such information like video_identifier, start_time, end_time in the csv file line by line, and download as well as trim the huge number of videos from youtube (such as Kinetics 400 dataset). Therefore a python code for automatically download just a portion of the video is needed for storage saving and also time-saving :)
Full code for that task could be such like the download.py I attached (I'm working on Windows 10)
download.txt

thanks for the quick reply
DUDE, thats PERFECT for what i need, i have text files full of ids and timestamps, some of which are from 3+ hours long podcasts. unfortunately i dont understand coding at all.
so far i changed download.txt to download.py, put it in to folder with csv file, downloaded anaconda3 and added it to environment variables. so few questions
1.
how should the csv file be named and formated? i could adapt it to your code.
video_id 1, output, start_time 1, end_time 1
video_id 1, output, start_time 2, end_time 2
video_id 2, output, start_time 1, end_time 1
pjJ2w1FX_Wg, C:\folder\name.mp4, 00:01:00, 00:01:30 for example?
2.
how do i run the python code? type download.py + path to the csv file in cmd?
thanks for your patience

Originally posted by @th3illu in #622 (comment)

@windspirit95
Copy link
Author

@windspirit95 windspirit95 commented May 25, 2020

@th3illu Since the original issue is locked, I open this issue for your recent question.
You can modify your csv file to have three similar columns in the middle like my attached txt file for downloading and trimming the video.
drinking.txt
By using my python download.py code, the sample command could be like this:
python download.py path_to_your_csv path_to_video_output_folder

@th3illu
Copy link

@th3illu th3illu commented May 25, 2020

THANK YOU! youre the best
it runs smooth with your example csv. now the challenge for me will be to modify my csv files to this formating, i can prolly do it via notepad++ regular expressions and maybe excel

@ytdl-org ytdl-org locked and limited conversation to collaborators May 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.