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

youtube-dl should be able to execute last ffmpeg command in stream #8269

Open
bertho-zero opened this issue Jan 18, 2016 · 5 comments
Open

youtube-dl should be able to execute last ffmpeg command in stream #8269

bertho-zero opened this issue Jan 18, 2016 · 5 comments

Comments

@bertho-zero
Copy link

@bertho-zero bertho-zero commented Jan 18, 2016

I would like to know if is possible to add a parameter (e.g: --stream) for execute the last ffmpeg command with the argument pipe:1 instead of file:xxx.

The utility of this argument is that we can make on-the-fly conversion.

For example:

python main.py -v -x --audio-format mp3 'https://www.youtube.com/watch?v=oavMtUWDBTM'
[debug] System config: []
[debug] User config: []
[debug] Command-line args: [u'-v', u'-x', u'--audio-format', u'mp3', u'https://www.youtube.com/watch?v=oavMtUWDBTM']
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2016.01.15
[debug] Git HEAD: a2badb1
[debug] Python version 2.7.10 - Linux-4.2.0-23-generic-x86_64-with-Ubuntu-15.10-wily
[debug] exe versions: ffmpeg 2.7.4-0ubuntu0.15.10.1, ffprobe 2.7.4-0ubuntu0.15.10.1
[debug] Proxy map: {}
[youtube] oavMtUWDBTM: Downloading webpage
[youtube] oavMtUWDBTM: Downloading video info webpage
[youtube] oavMtUWDBTM: Extracting video information
[youtube] oavMtUWDBTM: Downloading DASH manifest
[youtube] oavMtUWDBTM: Downloading DASH manifest
[debug] Invoking downloader on ...
[.........]
[download] Mr. Trololo original upload-oavMtUWDBTM.m4a has already been downloaded
[download] 100% of 4.91MiB
[ffmpeg] Correcting container in "Mr. Trololo original upload-oavMtUWDBTM.m4a"
[debug] ffmpeg command line: ffmpeg -y -i 'file:Mr. Trololo original upload-oavMtUWDBTM.m4a' -c copy -f mp4 'file:Mr. Trololo original upload-oavMtUWDBTM.temp.m4a'
[debug] ffmpeg command line: ffprobe -show_streams 'file:Mr. Trololo original upload-oavMtUWDBTM.m4a'
[ffmpeg] Destination: Mr. Trololo original upload-oavMtUWDBTM.mp3
[debug] ffmpeg command line: ffmpeg -y -i 'pipe:1' -vn -acodec libmp3lame -q:a 5 'file:Mr. Trololo original upload-oavMtUWDBTM.mp3'
Deleting original file Mr. Trololo original upload-oavMtUWDBTM.m4a (pass -k to keep)

become:

python main.py -v -x --audio-format mp3 'https://www.youtube.com/watch?v=oavMtUWDBTM'
[debug] System config: []
[debug] User config: []
[debug] Command-line args: [u'-v', u'-x', u'--audio-format', u'mp3', u'https://www.youtube.com/watch?v=oavMtUWDBTM']
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2016.01.15
[debug] Git HEAD: a2badb1
[debug] Python version 2.7.10 - Linux-4.2.0-23-generic-x86_64-with-Ubuntu-15.10-wily
[debug] exe versions: ffmpeg 2.7.4-0ubuntu0.15.10.1, ffprobe 2.7.4-0ubuntu0.15.10.1
[debug] Proxy map: {}
[youtube] oavMtUWDBTM: Downloading webpage
[youtube] oavMtUWDBTM: Downloading video info webpage
[youtube] oavMtUWDBTM: Extracting video information
[youtube] oavMtUWDBTM: Downloading DASH manifest
[youtube] oavMtUWDBTM: Downloading DASH manifest
[debug] Invoking downloader on ...
[.........]
[debug] ffmpeg command line: ffmpeg -y -i 'pipe:1' -vn -acodec libmp3lame -q:a 5 'pipe:1'
Deleting original file Mr. Trololo original upload-oavMtUWDBTM.m4a (pass -k to keep)

That would be really cool and it would help me a lot for a personal project, thank you in advance.

@bertho-zero
Copy link
Author

@bertho-zero bertho-zero commented Jan 18, 2016

It's a little like -o - parameter but for ffmpeg.

@asdfgasdfsafgsdfa
Copy link

@asdfgasdfsafgsdfa asdfgasdfsafgsdfa commented Feb 26, 2016

I'd need that as well.
Is it possible yet to let youtube-dl stream directly into ffmpeg to write a .mp3 file directly (mp3 is just an example).

I really cant use youtube-dl like I want because the -x only operates on a finished file.
But its not possible to completely download a radio stream or twitch or so because they are practically infinite length.

youtube-dl should use ffmpeg to convert, using stdin/stdout so it continously writes to the file and we can start using the audio file while data is still being written to it.

Please make this possible! @rg3

@bertho-zero
Copy link
Author

@bertho-zero bertho-zero commented Oct 16, 2017

Any news of this ?

@jnm2
Copy link

@jnm2 jnm2 commented Dec 26, 2017

I'd find this very helpful as well.

@a-x-
Copy link

@a-x- a-x- commented Jan 5, 2019

I want to extract audio from video streams too.

youtube-dl -x -o - vAKtNV8KcWg | node pipe.js

youtube-dl: error: Cannot download a video and extract audio into the same file! Use "-.%(ext)s" instead of "-" as the output template
pipe.js isn't interesting here, but...
express = require('express')
const app = express()
const port = 5556

app.get('/', (req, res) => process.stdin.pipe(res))

app.listen(port, () => console.log(`Example app listening on port ${port}!`))
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
4 participants
You can’t perform that action at this time.