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

Download audio and video without merging / muxing #14901

Closed
fkbreitl opened this issue Dec 3, 2017 · 7 comments
Closed

Download audio and video without merging / muxing #14901

fkbreitl opened this issue Dec 3, 2017 · 7 comments

Comments

@fkbreitl
Copy link

@fkbreitl fkbreitl commented Dec 3, 2017

I would like to download and save audio and video streams separately for audio only players as requested in #5964.

I can use the -k option to prevent the deletion of the audio and video only files, but I didn't find a way to prevent the post-processing or merging of the files. The --fixup never option didn't work.

How can I disable post-processing?

If there is no option to stop it, could it be implemented?

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Dec 4, 2017

Don't use + in -f.

@dstftw dstftw closed this Dec 4, 2017
@fkbreitl
Copy link
Author

@fkbreitl fkbreitl commented Dec 4, 2017

I left out the + in -f and I also replace the + by , but it didn't work. I still received a merged file.
The issue is still open. Please post a working example.

@remitamine
Copy link
Collaborator

@remitamine remitamine commented Dec 4, 2017

python __main__.py -f bestvideo,bestaudio https://www.youtube.com/watch?v=BaW_jenozKc
[youtube] BaW_jenozKc: Downloading webpage
[youtube] BaW_jenozKc: Downloading video info webpage
[youtube] BaW_jenozKc: Extracting video information
[youtube] BaW_jenozKc: Downloading MPD manifest
[info] BaW_jenozKc: downloading video in 2 formats
[download] Destination: youtube-dl test video ''_ä↭𝕐-BaW_jenozKc.mp4
[download] 100% of 2.11MiB in 00:03
[download] Destination: youtube-dl test video ''_ä↭𝕐-BaW_jenozKc.m4a
[download] 100% of 154.06KiB in 00:00
[ffmpeg] Correcting container in "youtube-dl test video ''_ä↭𝕐-BaW_jenozKc.m4a"
ffprobe youtube-dl\ test\ video\ \'\'_ä↭𝕐-BaW_jenozKc.mp4 
ffprobe version 3.4 Copyright (c) 2007-2017 the FFmpeg developers
  built with gcc 7.2.0 (GCC)
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-avisynth --enable-avresample --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libass --enable-libbluray --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxvid --enable-shared --enable-version3
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libavresample   3.  7.  0 /  3.  7.  0
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'youtube-dl test video ''_ä↭𝕐-BaW_jenozKc.mp4':
  Metadata:
    major_brand     : dash
    minor_version   : 0
    compatible_brands: iso6avc1mp41
    creation_time   : 2013-12-24T08:57:02.000000Z
  Duration: 00:00:09.80, start: 0.000000, bitrate: 1803 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 1920x1080, 934 kb/s, 30 fps, 30 tbr, 90k tbn, 60 tbc (default)
    Metadata:
      creation_time   : 2013-12-24T08:57:02.000000Z
      handler_name    : VideoHandler
ffprobe youtube-dl\ test\ video\ \'\'_ä↭𝕐-BaW_jenozKc.m4a 
ffprobe version 3.4 Copyright (c) 2007-2017 the FFmpeg developers
  built with gcc 7.2.0 (GCC)
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-avisynth --enable-avresample --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libass --enable-libbluray --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxvid --enable-shared --enable-version3
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libavresample   3.  7.  0 /  3.  7.  0
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'youtube-dl test video ''_ä↭𝕐-BaW_jenozKc.m4a':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    encoder         : Lavf57.83.100
  Duration: 00:00:09.89, start: 0.000000, bitrate: 127 kb/s
    Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 125 kb/s (default)
    Metadata:
      handler_name    : SoundHandler

works fine, separate video and audio without merging, if it's not actually working you should post the verbose output of you're command.

@fkbreitl
Copy link
Author

@fkbreitl fkbreitl commented Dec 4, 2017

Here is what I tried. I don't even see the separate audio and video files and obtain different results on the order of bestaudio, bestvideo.

host:~/test$ youtube-dl -f bestaudio,bestvideo -k https://www.youtube.com/watch?v=E4dSRpSnPOU
[youtube] E4dSRpSnPOU: Downloading webpage
[youtube] E4dSRpSnPOU: Downloading video info webpage
[youtube] E4dSRpSnPOU: Extracting video information
[youtube] E4dSRpSnPOU: Downloading MPD manifest
[info] E4dSRpSnPOU: downloading video in 2 formats
[download] Destination: Soma - Slam Positive Education-E4dSRpSnPOU.webm
[download] 100% of 8.41MiB in 00:06
[download] Soma - Slam Positive Education-E4dSRpSnPOU.webm has already been downloaded
[download] 100% of 8.41MiB
host:~/test$ ll
total 8.5M
-rw-r--r-- 1 fkbreitl fkbreitl 8.5M Jun  3  2017 Soma - Slam Positive Education-E4dSRpSnPOU.webm
host:~/test$ rm Soma\ -\ Slam\ Positive\ Education-E4dSRpSnPOU.webm 
host:~/test$ youtube-dl -f bestvideo,bestaudio -k https://www.youtube.com/watch?v=E4dSRpSnPOU
[youtube] E4dSRpSnPOU: Downloading webpage
[youtube] E4dSRpSnPOU: Downloading video info webpage
[youtube] E4dSRpSnPOU: Extracting video information
[youtube] E4dSRpSnPOU: Downloading MPD manifest
[info] E4dSRpSnPOU: downloading video in 2 formats
[download] Destination: Soma - Slam Positive Education-E4dSRpSnPOU.webm
[download] 100% of 14.95MiB in 00:11
[download] Soma - Slam Positive Education-E4dSRpSnPOU.webm has already been downloaded
[download] 100% of 14.95MiB
host:~/test$ ll
total 15M
-rw-r--r-- 1 fkbreitl fkbreitl 15M Jun  3  2017 Soma - Slam Positive Education-E4dSRpSnPOU.webm
host:~$ youtube-dl --version
2017.11.06
@remitamine
Copy link
Collaborator

@remitamine remitamine commented Dec 4, 2017

as both formats have the same ext, you should add format_id to the output template inorder to have a unique filename, as an example:

youtube-dl -f bestvideo,bestaudio -o '%(title)s-%(format_id)s.%(ext)s' https://www.youtube.com/watch?v=E4dSRpSnPOU
[youtube] E4dSRpSnPOU: Downloading webpage
[youtube] E4dSRpSnPOU: Downloading video info webpage
[youtube] E4dSRpSnPOU: Extracting video information
[youtube] E4dSRpSnPOU: Downloading MPD manifest
[info] E4dSRpSnPOU: downloading video in 2 formats
[download] Destination: Soma - Slam Positive Education-242.webm
[download] 100% of 14.95MiB in 00:34
[download] Destination: Soma - Slam Positive Education-251.webm
[download] 100% of 8.41MiB in 00:18
ffprobe Soma\ -\ Slam\ Positive\ Education-242.webm 
ffprobe version 3.4 Copyright (c) 2007-2017 the FFmpeg developers
  built with gcc 7.2.0 (GCC)
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-avisynth --enable-avresample --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libass --enable-libbluray --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxvid --enable-shared --enable-version3
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libavresample   3.  7.  0 /  3.  7.  0
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
Input #0, matroska,webm, from 'Soma - Slam Positive Education-242.webm':
  Metadata:
    encoder         : google
  Duration: 00:08:48.72, start: 0.000000, bitrate: 237 kb/s
    Stream #0:0(eng): Video: vp9 (Profile 0), yuv420p(tv), 426x238, SAR 1:1 DAR 213:119, 25 fps, 25 tbr, 1k tbn, 1k tbc (default)
ffprobe Soma\ -\ Slam\ Positive\ Education-251.webm 
ffprobe version 3.4 Copyright (c) 2007-2017 the FFmpeg developers
  built with gcc 7.2.0 (GCC)
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-avisynth --enable-avresample --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libass --enable-libbluray --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxvid --enable-shared --enable-version3
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libavresample   3.  7.  0 /  3.  7.  0
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
Input #0, matroska,webm, from 'Soma - Slam Positive Education-251.webm':
  Metadata:
    encoder         : google
  Duration: 00:08:48.80, start: -0.007000, bitrate: 133 kb/s
    Stream #0:0(eng): Audio: opus, 48000 Hz, stereo, fltp (default)
@fkbreitl
Copy link
Author

@fkbreitl fkbreitl commented Dec 4, 2017

Thank you, that seems to work.

However, it would be nice if a simple switch would exist to do this or at least if it would be documented somewhere that explicitly, since others have had the same question before:

https://unix.stackexchange.com/q/370732/159562

@remitamine
Copy link
Collaborator

@remitamine remitamine commented Dec 4, 2017

However, it would be nice if a simple switch would exist to do this or at least if it would be documented somewhere that explicitly.

it's not a common use case, and it's impossible to document evey use case.

since others have had the same question before:
https://unix.stackexchange.com/q/370732/159562

the question you're referring to is different, currently downloading with -f best is the best way to be able to start watching the video while it's been downloaded.

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
3 participants
You can’t perform that action at this time.