Cuelogic Blog Icon
Cuelogic Career Icon
Home > Blog > All > Service that can take a youtube, vimeo etc. url and convert it into an mp4 using ffmpeg library

Service that can take a youtube, vimeo etc. url and convert it into an mp4 using ffmpeg library

There are 2 steps with which we can convert youtube videos into .mp4.

Please check the following steps.

First Step:

Download Video from youtube:

For this we need to install the
youtube-dl
.

The youtube-dl Shell Script

#command

youtube-dl.py http://www.youtube.com/watch?v=tlWpnLdPwvk

#output
Setting language
tlWpnLdPwvk: Downloading video webpage
tlWpnLdPwvk: Extracting video information
tlWpnLdPwvk: URL: http://www.youtube.com/get_video?video_id=tlWpnLdPwvk&t=vjVQa1PpcFMZ4TkTSYXamGxmLZq-ot2l8Jx-HiNAf0I=&el=detailpage&ps=
[download] Destination: tlWpnLdPwvk.flv
[download] 100.0% of 18.78M at 53.98k/s ETA 00:00

Second Step:

Convert that video into .mp4 using ffmpeg:
The FFMPEG Shell Script
ffmpeg -i tlWpnLdPwvk.flv RodStewartMaggieMay.mp4

More information about the youtube-dl

I have collected necessary information about the youtube-dl installation and download commands. Please go through it.

1. How to install youtube-dl
1. In Windows save the exe version somewhere (in your PATH if you want to run it simply as youtube-dl) and run it from the command line.
2. In Unix, download it, give it execution permission and copy it to one of the PATH directories (typically, /usr/local/bin).
3. To update, simply call youtube-dl -U, we recommend to do it often.

Install youtube-dl in Ubuntu

sudo aptitude install youtube-dl
This will complete the installation.

How to Use:

1. youtube-dl Example
youtube-dl ” http://www.youtube.com/watch?v=foobar

2. You can change the file name of the video using the -o option, like in
youtube-dl -o vid.flv ” http://www.youtube.com/watch?v=foobar “.

Supported sites:

1. YouTube.com.
2. vimeo.
3. Google Plus.
4. Google Video.

And so many sites. Click here to check all supported site list.

For a complete list you can execute youtube-dl –list-extractors command.

youtube available formats:
http://en.wikipedia.org/wiki/YouTube#Quality_and_codecs

Convert Downloaded file into .mp4 using FFMPEG:
example: .flv convert into .mp4 file.
ffmpeg -i filename.flv -sameq -ar 22050 -vcodec libx264 filename.mp4

ffmpeg_library

YouTube, FFMPEG, and MP3 Conversion

Yesterday I published a quick post about a basic MPEG -> FLV video conversion method using FFMPEG. Today I want to share another great usage of FFMPEG: stripping a video’s audio and creating an MP3. As an added bonus, I’ll be ripping the audio from a great YouTube video using youtube-dl, a python script with loads of options for downloading YouTube videos.

via: davidwalsh.name