Easy partial download of mp4 with python and youtube-dl!

Purpose

Easily partially download mp4 with python and youtube-dl!

environment

$python3 --version
Python 3.7.3

Install ffmpeg for mkv, mp4 conversion

$brew install ffmpeg

DL folder creation

$mkdir mp4-download

Virtual environment for Python

$cd mp4-download
$python3 -m venv venv
$source venv/bin/activate

Install youtube-dl with pip

$pip install youtube-dl

Video (mkv) partial download

$ ffmpeg $(youtube-dl -g 'https://www.youtube.com/watch?v=Nyg2qysqgpg' | sed "s/.*/-ss 03:55:00 -i &/") -t 00:01:00 -c copy out.mkv

Convert mkv to mp4

$ for f in *.mkv;do ffmpeg -i "$f" -c:v copy -c:a aac -b:a 256k -strict -2 "${f%mkv}mp4";done

Check download results

$ open out.mp4

It was good

Recommended Posts

Easy partial download of mp4 with python and youtube-dl!
Easily download mp3 / mp4 with python and youtube-dl!
Coexistence of Python2 and 3 with CircleCI (1.0)
Easy modeling with Blender and Python
Easy introduction of speech recognition with Python
Easy introduction of python3 series and OpenCV3
Easy web scraping with Python and Ruby
I tried Jacobian and partial differential with python
Implementation of TRIE tree with Python and LOUDS
Download and import files with Splunk external python
Continuation of multi-platform development with Electron and Python
Example of reading and writing CSV with Python
Display embedded images of mp3 and flac with mutagen
[Python] How to specify the download location with youtube-dl
Visualize the range of interpolation and extrapolation with python
Comparison of CoffeeScript with JavaScript, Python and Ruby grammar
Version control of Node, Ruby and Python with anyenv
Programming with Python and Tkinter
Encryption and decryption with Python
Python and hardware-Using RS232C with Python-
[Co-occurrence analysis] Easy co-occurrence analysis with Python! [Python]
Easy folder synchronization with Python
Easy Python compilation with NUITKA-Utilities
Easy HTTP server with Python
python with pyenv and venv
Source installation and installation of Python
Download csv file with python
Works with Python and R
Easy to use Nifty Cloud API with botocore and python
Perform isocurrent analysis of open channels with Python and matplotlib
I tried follow management with Twitter API and Python (easy)
Get rid of dirty data with Python and regular expressions
Detect objects of a specific color and size with Python
How to convert Youtube to mp3 and download it super-safely [Python]
Sample of HTTP GET and JSON parsing with python of pepper
Play with the password mechanism of GitHub Webhook and Python
[Python] Easy reading of serial number image files with OpenCV
Easy deep learning web app with NNC and Python + Flask
Communicate with FX-5204PS with Python and PyUSB
Environment construction of python and opencv
Shining life with Python and OpenCV
I compared the speed of Hash with Topaz, Ruby and Python
The story of Python and the story of NaN
Robot running with Arduino and python
Install Python 2.7.9 and Python 3.4.x with pip.
Speed comparison of Wiktionary full text processing with F # and Python
[Python] Easy parallel processing with Joblib
Neural network with OpenCV 3 and Python 3
AM modulation and demodulation with python
Easy encryption of file contents (Python)
Installation of SciPy and matplotlib (Python)
[Python] font family and font with matplotlib
Scraping with Node, Ruby and Python
Easy Slackbot with Docker and Errbot
Implemented file download with Python + Bottle
Scraping with Python, Selenium and Chromedriver
Scraping with Python and Beautiful Soup
Manipulability ellipsoid of arm and mobile robot is drawn with python
Crawling with Python and Twitter API 2-Implementation of user search function
Getting Started with Python Basics of Python
MP3 to WAV conversion with Python