Format and Codec Conversion¶
In this tutorial we'll deal with convertion of codecs1 and formats. Lets start with this Youtube video by Arjan Codes.
codec_demo.py | |
---|---|
Info
YouTube DL Scraper allows for converting codecs1 and formats using the Converter
module at youtube_dl_scraper.converter
.
Now that we've downloaded our video, we can now convert it or change the format.
Changing Codec of video¶
To change the codec1 of a video is pretty simple, to do that well use our VideoConverter
class from our converter module.
Example
converting video codec | |
---|---|
- if the
output_path
argument is set to'.'
theoutput_file
will be saved at theinput_file
directory.
Output:
if you'd like to change the video format(ext) all you'll have to do is set theoutput_path
to a new path with the preffered extention for example 'downloads/converted.m4a'
.
You can also change the video audio codec1 because some videos contaons audio .
Example
Changing Codec of Audio¶
Changing the codec1 of an audio file is simillar to that of a video file, the only diffrence is the fact that we use the AudioConverter
class instead.
Example
converting video codec | |
---|---|
- if the
output_path
argument is set to'.'
theoutput_file
will be saved at theinput_file
directory.
Output:
But the AudioConverter
allows us to adjust the audio bitrate.
Example
Tip
You can also use the AudioConverter to convert a video to an audio file.
Output:For more info about the AudioConverter visit the api refrence of youtube_dl_scraper.converter.video_converter.VideoConverter.