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

How to use a different encoder? #13062

Closed
bat999 opened this issue May 12, 2017 · 2 comments
Closed

How to use a different encoder? #13062

bat999 opened this issue May 12, 2017 · 2 comments

Comments

@bat999
Copy link

@bat999 bat999 commented May 12, 2017

Hi
When I run youtube-dl with "--extract-audio --audio-format mp3 --audio-quality 64K" it uses FFmpeg something like this:-
ffmpeg -y -i file:foo -vn -acodec libmp3lame -b:a 64k file:foo.mp3

Is it possible to use "--extract-audio" with a custom command for FFmpeg?
Something like this:-
ffmpeg -y -i foo -ac 1 -f wav - | gogo -b 64 -m m -silent stdin foo.mp3
So that it uses the faster mp3 encoder "gogo-no-coda" instead of libmp3lame.

I'm using youtube-dl with Linux Mint.

~ $ youtube-dl -v
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: [u'-v']
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2017.05.09
[debug] Python version 2.7.12 - Linux-4.4.0-21-generic-x86_64-with-LinuxMint-18-sarah
[debug] exe versions: ffmpeg N-85996-g3d23219, ffprobe N-85996-g3d23219, rtmpdump 2.4

And gogo...

~ $ gogo
GOGO-no-coda ver. 3.13 ( May. 20 2004 ) is a mp3 encoder based on lame 3.88

This is an example command with libmp3lame...

~ $ youtube-dl --format worstaudio --extract-audio --audio-format mp3 --audio-quality 64K --restrict-filename --verbose http://www.bbc.co.uk/programmes/b08njwtn
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: [u'--format', u'worstaudio', u'--extract-audio', u'--audio-format', u'mp3', u'--audio-quality', u'64K', u'--restrict-filename', u'--verbose', u'http://www.bbc.co.uk/programmes/b08njwtn']
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2017.05.09
[debug] Python version 2.7.12 - Linux-4.4.0-21-generic-x86_64-with-LinuxMint-18-sarah
[debug] exe versions: ffmpeg N-85996-g3d23219, ffprobe N-85996-g3d23219, rtmpdump 2.4
[debug] Proxy map: {}
[bbc.co.uk] b08njwtn: Downloading video page
[bbc.co.uk] b08njwb7: Downloading media selection XML
[bbc.co.uk] b08njwb7: Downloading m3u8 information
[bbc.co.uk] b08njwb7: Downloading m3u8 information
[bbc.co.uk] b08njwb7: Downloading m3u8 information
[bbc.co.uk] b08njwb7: Downloading m3u8 information
[bbc.co.uk] b08njwb7: Downloading m3u8 information
[bbc.co.uk] b08njwb7: Downloading m3u8 information
[bbc.co.uk] b08njwb7: Downloading m3u8 information
[bbc.co.uk] b08njwb7: Downloading m3u8 information
[bbc.co.uk] b08njwb7: Downloading m3u8 information
[bbc.co.uk] b08njwb7: Downloading m3u8 information
[debug] Invoking downloader on u'http://aod-hls-uk-live.akamaized.net/usp/auth/vod/piff_abr_full_audio/b0925c-b08njwb7/vf_b08njwb7_82d70d85-22ee-4969-8019-993e09665019.ism/vf_b08njwb7_82d70d85-22ee-4969-8019-993e09665019-audio_eng_1=48000.m3u8'
[hlsnative] Downloading m3u8 manifest
[hlsnative] Total fragments: 17
[download] Destination: St_Mary_the_Virgin_Chislet_Bells_on_Sunday_-_BBC_Radio_4-b08njwb7.mp4
[download] 100% of 699.49KiB in 00:07
[debug] ffmpeg command line: ffprobe -show_streams file:St_Mary_the_Virgin_Chislet_Bells_on_Sunday_-_BBC_Radio_4-b08njwb7.mp4
[ffmpeg] Fixing malformated aac bitstream in "St_Mary_the_Virgin_Chislet_Bells_on_Sunday_-_BBC_Radio_4-b08njwb7.mp4"
[debug] ffmpeg command line: ffmpeg -y -i file:St_Mary_the_Virgin_Chislet_Bells_on_Sunday_-_BBC_Radio_4-b08njwb7.mp4 -c copy -f mp4 -bsf:a aac_adtstoasc file:St_Mary_the_Virgin_Chislet_Bells_on_Sunday_-_BBC_Radio_4-b08njwb7.temp.mp4
[debug] ffmpeg command line: ffprobe -show_streams file:St_Mary_the_Virgin_Chislet_Bells_on_Sunday_-_BBC_Radio_4-b08njwb7.mp4
[ffmpeg] Destination: St_Mary_the_Virgin_Chislet_Bells_on_Sunday_-_BBC_Radio_4-b08njwb7.mp3
[debug] ffmpeg command line: ffmpeg -y -i file:St_Mary_the_Virgin_Chislet_Bells_on_Sunday_-_BBC_Radio_4-b08njwb7.mp4 -vn -acodec libmp3lame -b:a 64k file:St_Mary_the_Virgin_Chislet_Bells_on_Sunday_-_BBC_Radio_4-b08njwb7.mp3
Deleting original file St_Mary_the_Virgin_Chislet_Bells_on_Sunday_-_BBC_Radio_4-b08njwb7.mp4 (pass -k to keep
```)
@bat999 bat999 changed the title How to use a different encoder. How to use a different encoder? May 12, 2017
@bat999
Copy link
Author

@bat999 bat999 commented May 12, 2017

Maybe I can do the job with a pipe instead of "--extract-audio".

This is my first attempt...

URL="http://www.bbc.co.uk/programmes/b08njwtn";\
a=$(youtube-dl --restrict-filename --get-filename $URL); \
youtube-dl --format worstaudio $URL -o - | ffmpeg -i - -ac 1 -f wav - | gogo -b 64 -m m -silent stdin "${a::-4}".mp3
@Hrxn
Copy link

@Hrxn Hrxn commented May 12, 2017

Yep. Pipes, or just a simple shell script.

@bat999 bat999 closed this May 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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.