> > > 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)) #20558

Closed
opened 2026-02-21 11:15:46 -05:00 by deekerman · 2 comments
Owner

Originally created by @windspirit95 on GitHub (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 https://github.com/ytdl-org/youtube-dl/issues/622#issuecomment-633394786

Originally created by @windspirit95 on GitHub (May 25, 2020). > > > 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)) > > > 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](https://user-images.githubusercontent.com/32880949/76725161-b2be7800-6790-11ea-898d-5ebd643ff41c.png) > > > 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](https://github.com/ytdl-org/youtube-dl/files/4674717/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 https://github.com/ytdl-org/youtube-dl/issues/622#issuecomment-633394786_
Author
Owner

@windspirit95 commented on GitHub (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

@windspirit95 commented on GitHub (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](https://github.com/ytdl-org/youtube-dl/files/4675722/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
Author
Owner

@th3illu commented on GitHub (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

@th3illu commented on GitHub (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
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/youtube-dl-ytdl-org#20558
No description provided.