Allow merging extracted tracks #9291

Open
opened 2026-02-21 05:01:20 -05:00 by deekerman · 17 comments
Owner

Originally created by @nmr50 on GitHub (Dec 2, 2016).

Hello dear authors, gurus. I have small Q:
What we have here -
format code extension resolution note
249 webm audio only DASH audio 53k , opus @ 50k (48000Hz), 4.51MiB
250 webm audio only DASH audio 75k , opus @ 70k (48000Hz), 5.20MiB
171 webm audio only DASH audio 118k , vorbis@128k (44100Hz), 8.02MiB
140 m4a audio only DASH audio 128k , m4a_dash container, mp4a.40.2@128k (44100
Hz), 11.56MiB
251 webm audio only DASH audio 146k , opus @160k (48000Hz), 9.51MiB
160 mp4 256x144 DASH video 114k , avc1.4d400c, 30fps, video only, 10.11MiB
278 webm 256x144 DASH video 117k , webm container, vp9, 30fps, video only, 8
.69MiB
242 webm 426x240 DASH video 248k , vp9, 30fps, video only, 19.69MiB
133 mp4 426x240 DASH video 253k , avc1.4d4015, 30fps, video only, 22.33MiB
243 webm 640x360 DASH video 452k , vp9, 30fps, video only, 36.37MiB
134 mp4 640x360 DASH video 638k , avc1.4d401e, 30fps, video only, 53.72MiB
244 webm 854x480 DASH video 836k , vp9, 30fps, video only, 67.12MiB
135 mp4 854x480 DASH video 1165k , avc1.4d401f, 30fps, video only, 102.34MiB
247 webm 1280x720 720p 1717k , vp9, 30fps, video only, 134.38MiB
136 mp4 1280x720 720p 2344k , avc1.4d401f, 30fps, video only, 203.90MiB
302 webm 1280x720 DASH video 2915k , vp9, 60fps, video only, 232.22MiB
248 webm 1920x1080 1080p 3139k , vp9, 30fps, video only, 238.95MiB
298 mp4 1280x720 DASH video 3493k , avc1.4d4020, 60fps, video only, 289.88MiB
137 mp4 1920x1080 1080p 4623k , avc1.640028, 30fps, video only, 384.84MiB
303 webm 1920x1080 DASH video 5095k , vp9, 60fps, video only, 394.73MiB
299 mp4 1920x1080 DASH video 6001k , avc1.64002a, 60fps, video only, 510.46MiB
17 3gp 176x144 small , mp4v.20.3, mp4a.40.2@ 24k
36 3gp 320x180 small , mp4v.20.3, mp4a.40.2
43 webm 640x360 medium , vp8.0, vorbis@128k
18 mp4 640x360 medium , avc1.42001E, mp4a.40.2@ 96k
22 mp4 1280x720 hd720 , avc1.64001F, mp4a.40.2@192k (best)

-- 299 is the best video-only track, yet 140 is audio-only track 128kbps, AND - 22 is the video+audio, with audio 192kbps. Please tell me, how to "rip" audio from 22 and combine it with 299 (as usual -f n+n) into one .mp4 ?
Thanks in advance !

Originally created by @nmr50 on GitHub (Dec 2, 2016). Hello dear authors, gurus. I have small Q: What we have here - format code extension resolution note 249 webm audio only DASH audio 53k , opus @ 50k (48000Hz), 4.51MiB 250 webm audio only DASH audio 75k , opus @ 70k (48000Hz), 5.20MiB 171 webm audio only DASH audio 118k , vorbis@128k (44100Hz), 8.02MiB 140 m4a audio only DASH audio 128k , m4a_dash container, mp4a.40.2@128k (44100 Hz), 11.56MiB 251 webm audio only DASH audio 146k , opus @160k (48000Hz), 9.51MiB 160 mp4 256x144 DASH video 114k , avc1.4d400c, 30fps, video only, 10.11MiB 278 webm 256x144 DASH video 117k , webm container, vp9, 30fps, video only, 8 .69MiB 242 webm 426x240 DASH video 248k , vp9, 30fps, video only, 19.69MiB 133 mp4 426x240 DASH video 253k , avc1.4d4015, 30fps, video only, 22.33MiB 243 webm 640x360 DASH video 452k , vp9, 30fps, video only, 36.37MiB 134 mp4 640x360 DASH video 638k , avc1.4d401e, 30fps, video only, 53.72MiB 244 webm 854x480 DASH video 836k , vp9, 30fps, video only, 67.12MiB 135 mp4 854x480 DASH video 1165k , avc1.4d401f, 30fps, video only, 102.34MiB 247 webm 1280x720 720p 1717k , vp9, 30fps, video only, 134.38MiB 136 mp4 1280x720 720p 2344k , avc1.4d401f, 30fps, video only, 203.90MiB 302 webm 1280x720 DASH video 2915k , vp9, 60fps, video only, 232.22MiB 248 webm 1920x1080 1080p 3139k , vp9, 30fps, video only, 238.95MiB 298 mp4 1280x720 DASH video 3493k , avc1.4d4020, 60fps, video only, 289.88MiB 137 mp4 1920x1080 1080p 4623k , avc1.640028, 30fps, video only, 384.84MiB 303 webm 1920x1080 DASH video 5095k , vp9, 60fps, video only, 394.73MiB 299 mp4 1920x1080 DASH video 6001k , avc1.64002a, 60fps, video only, 510.46MiB 17 3gp 176x144 small , mp4v.20.3, mp4a.40.2@ 24k 36 3gp 320x180 small , mp4v.20.3, mp4a.40.2 43 webm 640x360 medium , vp8.0, vorbis@128k 18 mp4 640x360 medium , avc1.42001E, mp4a.40.2@ 96k 22 mp4 1280x720 hd720 , avc1.64001F, mp4a.40.2@192k (best) -- 299 is the best video-only track, yet 140 is audio-only track 128kbps, AND - 22 is the video+audio, with audio 192kbps. Please tell me, how to "rip" audio from 22 and combine it with 299 (as usual -f n+n) into one .mp4 ? Thanks in advance !
Author
Owner

@iMrQuake commented on GitHub (Dec 3, 2016):

Hi,

if you use m4a, it will automatically select best audio, bestvideo will d the same, what ever the format.
so if you want best audio as m4a and best available video as mp4 lower or equal to 720p, use this:
--format (bestvideo[ext=mp4][height<=?720]+bestaudio[ext=m4a])

so for you:
--format (bestvideo[ext=mp4]+bestaudio[ext=m4a])

this should select 299 for video and 140

if you want the audio of 22, i am afraid, you will have to download:
299 end 22
then ask ffmpeg to extract audio from 22
then ask ffmpeg to merge extracted audio into 299

i don't think you can do it it one command, but there is also an opition to extract audio:
--extract-audio to use while downloading 22

@iMrQuake commented on GitHub (Dec 3, 2016): Hi, if you use m4a, it will automatically select best audio, bestvideo will d the same, what ever the format. so if you want best audio as m4a and best available video as mp4 lower or equal to 720p, use this: `--format (bestvideo[ext=mp4][height<=?720]+bestaudio[ext=m4a])` so for you: `--format (bestvideo[ext=mp4]+bestaudio[ext=m4a])` this should select 299 for video and 140 if you want the audio of 22, i am afraid, you will have to download: 299 end 22 then ask ffmpeg to extract audio from 22 then ask ffmpeg to merge extracted audio into 299 i don't think you can do it it one command, but there is also an opition to extract audio: --extract-audio to use while downloading 22
Author
Owner

@nmr50 commented on GitHub (Dec 3, 2016):

then ask ffmpeg to extract audio from 22, then ask ffmpeg to merge extracted audio into 299
Can you, please, specify more precise info how to do these 2 steps?:)
Thanks in advance!

@nmr50 commented on GitHub (Dec 3, 2016): **then ask ffmpeg to extract audio from 22, then ask ffmpeg to merge extracted audio into 299** Can you, please, specify more precise info how to do these 2 steps?:) Thanks in advance!
Author
Owner

@iMrQuake commented on GitHub (Dec 3, 2016):

well according to ffmpeg user guide, something like that:
ffmpeg -i downloaded_video_22.mp4 -acodec copy audio_of_the_file.m4a
this will extract a pure copy of the audio file, mp4 is a container, grouping 2 files, the audio and the video
-acodec means audio
-vcodec means video

@iMrQuake commented on GitHub (Dec 3, 2016): well according to ffmpeg user guide, something like that: ` ffmpeg -i downloaded_video_22.mp4 -acodec copy audio_of_the_file.m4a` this will extract a pure copy of the audio file, mp4 is a container, grouping 2 files, the audio and the video `-acodec` means audio `-vcodec` means video
Author
Owner

@iMrQuake commented on GitHub (Dec 3, 2016):

And if you ask then how to merge the extracted audio and 299 video then do:

ffmpeg -i video_format_299.mp4 -i audio.m4a -c:v copy -c:a copy video_and_audio.mp4

You will get a 1080p60fps with mp4a.40.2@192k

with any quality lose because we only copy or extract file into/from container

@iMrQuake commented on GitHub (Dec 3, 2016): And if you ask then how to merge the extracted audio and 299 video then do: `ffmpeg -i video_format_299.mp4 -i audio.m4a -c:v copy -c:a copy video_and_audio.mp4` You will get a 1080p60fps with mp4a.40.2@192k with any quality lose because we only copy or extract file into/from container
Author
Owner

@nmr50 commented on GitHub (Dec 4, 2016):

iMrQuake - Many thanks for such wonderful help!:)
Now I found very interesting stuff. OK, youtube-dl -F somevideo.from.youtube
Once again I see 140, 137 (in this case), and 22:
140 m4a audio only DASH audio 128k , m4a_dash container, mp4a.40.2@128k (44100Hz), 2.03MiB
137 mp4 1920x1080 DASH video 3660k , avc1.640028, 25fps, video only, 37.55MiB
22 mp4 1280x720 hd720 , avc1.64001F, mp4a.40.2@192k (best)

I'm taking 1st file with 137+140 flags (fullhd with 128kbps m4a audio , as it seems), right after that I'm taking 2nd file with 22 flag, and when I am trying to rip audio from that video.22.mp4 - I see THIS:

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from somevideo.mp4':
Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720 [SAR 1:1 DAR 16:9], 1265 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc (default)
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 125 kb/s (default)

And I wonder. Y-DL clearly shows me that "22" is 192kbps audio, now ffmpeg telling me that m4a track inside that "22" .mp4 is not 192kbps, but 128kbps ...yet VLC is showing that audio in this .mp4 is 128kbps... what's the catch ?
Sample video is Metallica-Atlas, rise! : https://youtu.be/JFAcOnhcpGA
-t

@nmr50 commented on GitHub (Dec 4, 2016): iMrQuake - Many thanks for such wonderful help!:) Now I found very interesting stuff. OK, youtube-dl -F somevideo.from.youtube Once again I see 140, 137 (in this case), and 22: 140 m4a audio only DASH audio 128k , m4a_dash container, mp4a.40.2@128k (44100Hz), 2.03MiB 137 mp4 1920x1080 DASH video 3660k , avc1.640028, 25fps, video only, 37.55MiB 22 mp4 1280x720 hd720 , avc1.64001F, **mp4a.40.2@192k (best)** I'm taking 1st file with 137+140 flags (fullhd with 128kbps m4a audio , as it seems), right after that I'm taking 2nd file with 22 flag, and when I am trying to rip audio from that video.22.mp4 - I see THIS: Input #0, mov,mp4,m4a,3gp,3g2,mj2, from somevideo.mp4': Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720 [SAR 1:1 DAR 16:9], 1265 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc (default) Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), **44100 Hz, stereo, fltp, 125 kb/s** (default) And I wonder. Y-DL clearly shows me that "22" is 192kbps audio, now ffmpeg telling me that m4a track inside that "22" .mp4 is not 192kbps, but 128kbps ...yet VLC is showing that audio in this .mp4 is 128kbps... what's the catch ? Sample video is Metallica-Atlas, rise! : https://youtu.be/JFAcOnhcpGA -t
Author
Owner

@iMrQuake commented on GitHub (Dec 4, 2016):

to be sure, you can ask ffprobe
but Y-DL just give you a "format description", it doe snot means it is the true, it is coming from youtube, not youtube-dl

thats why now, i just download format individualy, and i merge them later with ffmpeg or mkvtoolnix

@iMrQuake commented on GitHub (Dec 4, 2016): to be sure, you can ask ffprobe but Y-DL just give you a "format description", it doe snot means it is the true, it is coming from youtube, not youtube-dl thats why now, i just download format individualy, and i merge them later with ffmpeg or mkvtoolnix
Author
Owner

@iMrQuake commented on GitHub (Dec 4, 2016):

if you want, what you can do is:
ask the url of the file you want:
youtube-dl -f 140 --get-url
you will get only the direct url
then you can:

  • download the file with any downloader or you can ask
  • ask ffmpeg the real format: ffmpeg -i "the url from previous command" -f null -
    This will download only the format information
    then decide or not to download file from video or from 140 format
@iMrQuake commented on GitHub (Dec 4, 2016): if you want, what you can do is: ask the url of the file you want: `youtube-dl -f 140 --get-url` you will get only the direct url then you can: - download the file with any downloader or you can ask - ask ffmpeg the real format: `ffmpeg -i "the url from previous command" -f null -` This will download only the format information then decide or not to download file from video or from 140 format
Author
Owner

@iMrQuake commented on GitHub (Dec 4, 2016):

Let's do it in you video use case ( i know your lusic stle now ;)))) )
youtube-dl -f 22 --get-url https://www.youtube.com/watch?v=JFAcOnhcpGA
will give you the direct link to the 22 video:

https://r5---sn-25g7sn7z.googlevideo.com/videoplayback?sparams=dur%2Cei%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cnh%2Cpl%2Cratebypass%2Crequiressl%2Csource%2Cupn%2Cexpire&mm=31&mn=sn-25g7sn7z&key=yt6&ei=IAJEWImSKc2vcMmjtJgB&ms=au&mt=1480851643&mv=m&pl=16&requiressl=yes&itag=22&lmt=1478063041415794&ip=90.5.60.148&dur=391.790&source=youtube&id=o-AKbwaqxm-kDbhz5dfpNQbemHzHDSc80YHdzAGsN0fe_W&nh=IgpwcjAzLnBhcjAxKg4yMDkuODUuMTcyLjE1MQ&upn=FpdTKJIILis&mime=video%2Fmp4&expire=1480873600&ipbits=0&ratebypass=yes&initcwndbps=900000&signature=B980141C11D26AE8432401F34309E8633C04DFDD.A2C063A8E521D42A8EAC50E23519822DF75BC042

Then ask format, you can cancel the download from ffmpeg (yes, it can download) & add the double quote for the url:
ffmpeg -i "https://r5---sn-25g7sn7z.googlevideo.com/videoplayback?sparams=dur%2Cei%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cnh%2Cpl%2Cratebypass%2Crequiressl%2Csource%2Cupn%2Cexpire&mm=31&mn=sn-25g7sn7z&key=yt6&ei=IAJEWImSKc2vcMmjtJgB&ms=au&mt=1480851643&mv=m&pl=16&requiressl=yes&itag=22&lmt=1478063041415794&ip=90.5.60.148&dur=391.790&source=youtube&id=o-AKbwaqxm-kDbhz5dfpNQbemHzHDSc80YHdzAGsN0fe_W&nh=IgpwcjAzLnBhcjAxKg4yMDkuODUuMTcyLjE1MQ&upn=FpdTKJIILis&mime=video%2Fmp4&expire=1480873600&ipbits=0&ratebypass=yes&initcwndbps=900000&signature=B980141C11D26AE8432401F34309E8633C04DFDD.A2C063A8E521D42A8EAC50E23519822DF75BC042" -f null -

Will give you:

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'https://r5---sn-25g7sn7z.googlevideo.com/videoplayback?expire=1480873421&upn=_VyL7G0mVfQ&ei=bQFEWKy7JsmRcPPgv4gI&key=yt6&mime=video%2Fmp4&initcwndbps=900000&ratebypass=yes&nh=IgpwcjAzLnBhcjAxKg4yMDkuODUuMTcyLjE1MQ&lmt=1478063041415794&dur=391.790&source=youtube&sparams=dur%2Cei%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cnh%2Cpl%2Cratebypass%2Crequiressl%2Csource%2Cupn%2Cexpire&requiressl=yes&ipbits=0&itag=22&mm=31&ip=90.5.60.148&mv=m&mt=1480851643&ms=au&mn=sn-25g7sn7z&pl=16&id=o-AHIBpkdXuyH2kb-LV0e0byV8ZhsctpRxuOJAAXWg37YX&signature=288AD681EF29EBF2B982E607D330E3CB521599D7.D09816D16A5B0095A54B0F17B80FFA5DF9538E90':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2016-11-02T05:03:33.000000Z
  Duration: 00:06:31.74, start: 0.000000, bitrate: 1538 kb/s
    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720 [SAR 1:1 DAR 16:9], 1409 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc (default)
    Metadata:
      creation_time   : 2016-11-02T05:03:33.000000Z
      handler_name    : ISO Media file produced by Google Inc.
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 125 kb/s (default)
    Metadata:
      creation_time   : 2016-11-02T05:03:33.000000Z
      handler_name    : ISO Media file produced by Google Inc.
Output #0, null, to 'pipe:':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    encoder         : Lavf57.56.100
    Stream #0:0(und): Video: wrapped_avframe, yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 29.97 fps, 29.97 tbn, 29.97 tbc (default)
    Metadata:
      creation_time   : 2016-11-02T05:03:33.000000Z
      handler_name    : ISO Media file produced by Google Inc.
      encoder         : Lavc57.64.101 wrapped_avframe
    Stream #0:1(und): Audio: pcm_s16le, 44100 Hz, stereo, s16, 1411 kb/s (default)
    Metadata:
      creation_time   : 2016-11-02T05:03:33.000000Z
      handler_name    : ISO Media file produced by Google Inc.
      encoder         : Lavc57.64.101 pcm_s16le
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> wrapped_avframe (native))
  Stream #0:1 -> #0:1 (aac (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
frame=  624 fps=133 q=-0.0 Lsize=N/A time=00:00:20.99 bitrate=N/A speed=4.48x 

So you can see all the details of the "true" file format hosted

do the same with format 140

Now you have all the tool to do your stuff

@iMrQuake commented on GitHub (Dec 4, 2016): Let's do it in you video use case ( i know your lusic stle now ;)))) ) `youtube-dl -f 22 --get-url https://www.youtube.com/watch?v=JFAcOnhcpGA` will give you the direct link to the 22 video: > https://r5---sn-25g7sn7z.googlevideo.com/videoplayback?sparams=dur%2Cei%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cnh%2Cpl%2Cratebypass%2Crequiressl%2Csource%2Cupn%2Cexpire&mm=31&mn=sn-25g7sn7z&key=yt6&ei=IAJEWImSKc2vcMmjtJgB&ms=au&mt=1480851643&mv=m&pl=16&requiressl=yes&itag=22&lmt=1478063041415794&ip=90.5.60.148&dur=391.790&source=youtube&id=o-AKbwaqxm-kDbhz5dfpNQbemHzHDSc80YHdzAGsN0fe_W&nh=IgpwcjAzLnBhcjAxKg4yMDkuODUuMTcyLjE1MQ&upn=FpdTKJIILis&mime=video%2Fmp4&expire=1480873600&ipbits=0&ratebypass=yes&initcwndbps=900000&signature=B980141C11D26AE8432401F34309E8633C04DFDD.A2C063A8E521D42A8EAC50E23519822DF75BC042 Then ask format, you can cancel the download from ffmpeg (yes, it can download) & add the double quote for the url: `ffmpeg -i "https://r5---sn-25g7sn7z.googlevideo.com/videoplayback?sparams=dur%2Cei%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cnh%2Cpl%2Cratebypass%2Crequiressl%2Csource%2Cupn%2Cexpire&mm=31&mn=sn-25g7sn7z&key=yt6&ei=IAJEWImSKc2vcMmjtJgB&ms=au&mt=1480851643&mv=m&pl=16&requiressl=yes&itag=22&lmt=1478063041415794&ip=90.5.60.148&dur=391.790&source=youtube&id=o-AKbwaqxm-kDbhz5dfpNQbemHzHDSc80YHdzAGsN0fe_W&nh=IgpwcjAzLnBhcjAxKg4yMDkuODUuMTcyLjE1MQ&upn=FpdTKJIILis&mime=video%2Fmp4&expire=1480873600&ipbits=0&ratebypass=yes&initcwndbps=900000&signature=B980141C11D26AE8432401F34309E8633C04DFDD.A2C063A8E521D42A8EAC50E23519822DF75BC042" -f null -` Will give you: ``` Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'https://r5---sn-25g7sn7z.googlevideo.com/videoplayback?expire=1480873421&upn=_VyL7G0mVfQ&ei=bQFEWKy7JsmRcPPgv4gI&key=yt6&mime=video%2Fmp4&initcwndbps=900000&ratebypass=yes&nh=IgpwcjAzLnBhcjAxKg4yMDkuODUuMTcyLjE1MQ&lmt=1478063041415794&dur=391.790&source=youtube&sparams=dur%2Cei%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cnh%2Cpl%2Cratebypass%2Crequiressl%2Csource%2Cupn%2Cexpire&requiressl=yes&ipbits=0&itag=22&mm=31&ip=90.5.60.148&mv=m&mt=1480851643&ms=au&mn=sn-25g7sn7z&pl=16&id=o-AHIBpkdXuyH2kb-LV0e0byV8ZhsctpRxuOJAAXWg37YX&signature=288AD681EF29EBF2B982E607D330E3CB521599D7.D09816D16A5B0095A54B0F17B80FFA5DF9538E90': Metadata: major_brand : mp42 minor_version : 0 compatible_brands: isommp42 creation_time : 2016-11-02T05:03:33.000000Z Duration: 00:06:31.74, start: 0.000000, bitrate: 1538 kb/s Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720 [SAR 1:1 DAR 16:9], 1409 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc (default) Metadata: creation_time : 2016-11-02T05:03:33.000000Z handler_name : ISO Media file produced by Google Inc. Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 125 kb/s (default) Metadata: creation_time : 2016-11-02T05:03:33.000000Z handler_name : ISO Media file produced by Google Inc. Output #0, null, to 'pipe:': Metadata: major_brand : mp42 minor_version : 0 compatible_brands: isommp42 encoder : Lavf57.56.100 Stream #0:0(und): Video: wrapped_avframe, yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 29.97 fps, 29.97 tbn, 29.97 tbc (default) Metadata: creation_time : 2016-11-02T05:03:33.000000Z handler_name : ISO Media file produced by Google Inc. encoder : Lavc57.64.101 wrapped_avframe Stream #0:1(und): Audio: pcm_s16le, 44100 Hz, stereo, s16, 1411 kb/s (default) Metadata: creation_time : 2016-11-02T05:03:33.000000Z handler_name : ISO Media file produced by Google Inc. encoder : Lavc57.64.101 pcm_s16le Stream mapping: Stream #0:0 -> #0:0 (h264 (native) -> wrapped_avframe (native)) Stream #0:1 -> #0:1 (aac (native) -> pcm_s16le (native)) Press [q] to stop, [?] for help frame= 624 fps=133 q=-0.0 Lsize=N/A time=00:00:20.99 bitrate=N/A speed=4.48x ``` So you can see all the details of the "true" file format hosted do the same with format 140 Now you have all the tool to do your stuff
Author
Owner
@iMrQuake commented on GitHub (Dec 4, 2016): after checking, the file 140 is exactly the same audio format than the one in 22: **https://r5---sn-25g7sn7z.googlevideo.com/videoplayback?dur=391.790&ipbits=0&expire=1480874030&itag=140&clen=6223289&key=yt6&gir=yes&mime=audio%2Fmp4&nh=IgpwcjAzLnBhcjEwKgkxMjcuMC4wLjE&keepalive=yes&ei=zgNEWP78FcLOctPbrcgG&initcwndbps=1062500&source=youtube&upn=pRkDuT9s51Y&pl=16&id=o-AFrfunQjbanSCcyKfWS960YhIM-GtmQTQZuYsViqa0uc&mn=sn-25g7sn7z&mm=31&lmt=1478062333126723&requiressl=yes&ip=90.5.60.148&ms=au&mv=m&sparams=clen%2Cdur%2Cei%2Cgir%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Ckeepalive%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cnh%2Cpl%2Crequiressl%2Csource%2Cupn%2Cexpire&mt=1480852295&signature=1218EEC9856BD41D86B6E5013407FFF81DDAE61D.23198142756515DDBC00CBFAF80CB69FF0685FE6&ratebypass=yes**
Author
Owner

@iMrQuake commented on GitHub (Dec 4, 2016):

22 : Audio: pcm_s16le, 44100 Hz, stereo, s16, 1411 kb/s (default)
140: Audio: Audio: pcm_s16le, 44100 Hz, stereo, s16, 1411 kb/s (default)

@iMrQuake commented on GitHub (Dec 4, 2016): 22 : Audio: pcm_s16le, 44100 Hz, stereo, s16, 1411 kb/s (default) 140: Audio: Audio: pcm_s16le, 44100 Hz, stereo, s16, 1411 kb/s (default)
Author
Owner

@nmr50 commented on GitHub (Dec 4, 2016):

Sorry, iMrQuake, I do not see pure pcm 1411kbps audio at all.
I'll repeat what you've typed:
ffmpeg.exe -i "https://r10---sn-n8v7snek.googlevideo.com/videoplayback?mime=video%2Fmp4&requiressl=yes&ratebypass=yes&ipbits=0&lmt=1478063041415794&expire=1480898306&sparams=dur%2Cei%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Cratebypass%2Crequiressl%2Csource%2Cupn%2Cexpire&itag=22&upn=yaLolxqEnPk&key=yt6&ip=89.20.134.92&mm=31&mn=sn-n8v7snek&mt=1480876417&mv=m&ei=omJEWM-aLdWvYImqgqgK&id=o-AMzTrT_NZemJEbEM273C3kpKbPIkgnMkbXE_gK9fkySv&ms=au&source=youtube&pl=23&dur=391.790&initcwndbps=1332500&signature=5B65D15F5BE49B7354F050D8C6AD03354B5A409F.7A4A71A6983FBC7C96E9FA40F91F7B743AD18694"
....
Duration: 00:06:31.74, start: 0.000000, bitrate: 1538 kb/s
Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720 [SAR 1:1 DAR 16:9], 1409 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc (default)
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 125 kb/s (default)

What say you ?

@nmr50 commented on GitHub (Dec 4, 2016): Sorry, iMrQuake, I **do not see** pure pcm 1411kbps audio at all. I'll repeat what you've typed: ffmpeg.exe -i "https://r10---sn-n8v7snek.googlevideo.com/videoplayback?mime=video%2Fmp4&requiressl=yes&ratebypass=yes&ipbits=0&lmt=1478063041415794&expire=1480898306&sparams=dur%2Cei%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Cratebypass%2Crequiressl%2Csource%2Cupn%2Cexpire&itag=22&upn=yaLolxqEnPk&key=yt6&ip=89.20.134.92&mm=31&mn=sn-n8v7snek&mt=1480876417&mv=m&ei=omJEWM-aLdWvYImqgqgK&id=o-AMzTrT_NZemJEbEM273C3kpKbPIkgnMkbXE_gK9fkySv&ms=au&source=youtube&pl=23&dur=391.790&initcwndbps=1332500&signature=5B65D15F5BE49B7354F050D8C6AD03354B5A409F.7A4A71A6983FBC7C96E9FA40F91F7B743AD18694" .... Duration: 00:06:31.74, start: 0.000000, bitrate: 1538 kb/s Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720 [SAR 1:1 DAR 16:9], 1409 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc (default) Stream #0:1(und): **Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 125 kb/s (default)** What say you ?
Author
Owner

@iMrQuake commented on GitHub (Dec 4, 2016):

maybe we don't have same version of tools, but you have all you need to build your files now.

u r right i got this (maybe was one of my video ;) ): but same principal, you do have the real spec of the file to be downloaded:

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'https://r10---sn-n8v7snek.googlevideo.com/videoplayback?mime=video%2Fmp4&requiressl=yes&ratebypass=yes&ipbits=0&lmt=1478063041415794&expire=1480898306&sparams=dur%2Cei%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Cratebypass%2Crequiressl%2Csource%2Cupn%2Cexpire&itag=22&upn=yaLolxqEnPk&key=yt6&ip=89.20.134.92&mm=31&mn=sn-n8v7snek&mt=1480876417&mv=m&ei=omJEWM-aLdWvYImqgqgK&id=o-AMzTrT_NZemJEbEM273C3kpKbPIkgnMkbXE_gK9fkySv&ms=au&source=youtube&pl=23&dur=391.790&initcwndbps=1332500&signature=5B65D15F5BE49B7354F050D8C6AD03354B5A409F.7A4A71A6983FBC7C96E9FA40F91F7B743AD18694':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2016-11-02T05:03:33.000000Z
  Duration: 00:06:31.74, start: 0.000000, bitrate: 1538 kb/s
    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720 [SAR 1:1 DAR 16:9], 1409 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc (default)
    Metadata:
      creation_time   : 2016-11-02T05:03:33.000000Z
      handler_name    : ISO Media file produced by Google Inc.
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 125 kb/s (default)
    Metadata:
      creation_time   : 2016-11-02T05:03:33.000000Z
      handler_name    : ISO Media file produced by Google Inc.

you can use
ffprobe -i url

it will not download

@iMrQuake commented on GitHub (Dec 4, 2016): maybe we don't have same version of tools, but you have all you need to build your files now. u r right i got this (maybe was one of my video ;) ): but same principal, you do have the real spec of the file to be downloaded: ``` Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'https://r10---sn-n8v7snek.googlevideo.com/videoplayback?mime=video%2Fmp4&requiressl=yes&ratebypass=yes&ipbits=0&lmt=1478063041415794&expire=1480898306&sparams=dur%2Cei%2Cid%2Cinitcwndbps%2Cip%2Cipbits%2Citag%2Clmt%2Cmime%2Cmm%2Cmn%2Cms%2Cmv%2Cpl%2Cratebypass%2Crequiressl%2Csource%2Cupn%2Cexpire&itag=22&upn=yaLolxqEnPk&key=yt6&ip=89.20.134.92&mm=31&mn=sn-n8v7snek&mt=1480876417&mv=m&ei=omJEWM-aLdWvYImqgqgK&id=o-AMzTrT_NZemJEbEM273C3kpKbPIkgnMkbXE_gK9fkySv&ms=au&source=youtube&pl=23&dur=391.790&initcwndbps=1332500&signature=5B65D15F5BE49B7354F050D8C6AD03354B5A409F.7A4A71A6983FBC7C96E9FA40F91F7B743AD18694': Metadata: major_brand : mp42 minor_version : 0 compatible_brands: isommp42 creation_time : 2016-11-02T05:03:33.000000Z Duration: 00:06:31.74, start: 0.000000, bitrate: 1538 kb/s Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720 [SAR 1:1 DAR 16:9], 1409 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc (default) Metadata: creation_time : 2016-11-02T05:03:33.000000Z handler_name : ISO Media file produced by Google Inc. Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 125 kb/s (default) Metadata: creation_time : 2016-11-02T05:03:33.000000Z handler_name : ISO Media file produced by Google Inc. ``` you can use `ffprobe -i url` it will not download
Author
Owner

@nmr50 commented on GitHub (Dec 4, 2016):

So, the main "concept" is to run ffmpeg -i url every time with hope that there will be pure pcm stream/192kbps m4a, right?;) Anyway, I've never seen pcm 1411 in -f 22 until this time, you said, and - can you, please, provide real URL with this one?

@nmr50 commented on GitHub (Dec 4, 2016): So, the main "concept" is to run ffmpeg -i url every time with hope that there will be pure pcm stream/192kbps m4a, right?;) Anyway, I've never seen pcm 1411 in -f 22 until this time, you said, and - can you, please, provide real URL with this one?
Author
Owner

@iMrQuake commented on GitHub (Dec 5, 2016):

forget about pcm for you video, it was a error from me, but as explain, if you read all post, you have all you need to do your stuff !
you list the available format with
youtube-dl -F url
then you retireve the url for a specific format:
youtube-dl -f format_id -g url
than you ask codec details with ffprobe:
ffprobe -i "url" dont forget the double quotes

if the format is good for you than download the file

if the format in video is better than dash audio, then download video and extract audio withh ffmpeg, or use extract-audio from youtube-dl.

@iMrQuake commented on GitHub (Dec 5, 2016): forget about pcm for you video, it was a error from me, but as explain, if you read all post, you have all you need to do your stuff ! you list the available format with **youtube-dl -F url** then you retireve the url for a specific format: **youtube-dl -f format_id -g url** than you ask codec details with ffprobe: **ffprobe -i "url"** dont forget the double quotes if the format is good for you than download the file if the format in video is better than dash audio, then download video and extract audio withh ffmpeg, or use extract-audio from youtube-dl.
Author
Owner

@nmr50 commented on GitHub (Dec 6, 2016):

iMrQuake, thanks! But still I wonder - if there any real 192kbps m4a audio in format 22, or it is always 128kbps with wrong 192kbps label...

@nmr50 commented on GitHub (Dec 6, 2016): iMrQuake, thanks! But still I wonder - if there any **real** 192kbps m4a audio in format 22, or it is always 128kbps with wrong 192kbps label...
Author
Owner

@iMrQuake commented on GitHub (Dec 6, 2016):

i cannot tell, we anyway, we dont know the original format of the source, maybe the file is just upscaled by youtube.com, for me it is just a "target format", no sure if it is the real format. Only youtube can tell you, but this would means also, that all people are uplaoding this source format, and it is not the case, so your file is for sur a result of automatic conversion from youtube, and conversion means no lossless here

@iMrQuake commented on GitHub (Dec 6, 2016): i cannot tell, we anyway, we dont know the original format of the source, maybe the file is just upscaled by youtube.com, for me it is just a "target format", no sure if it is the real format. Only youtube can tell you, but this would means also, that all people are uplaoding this source format, and it is not the case, so your file is for sur a result of automatic conversion from youtube, and conversion means no lossless here
Author
Owner

@yan12125 commented on GitHub (Dec 9, 2016):

how to "rip" audio from 22 and combine it with 299 (as usual -f n+n) into one .mp4 ?

As @iMrQuake said, currently you need to do that manually with ffmpeg. I guess it would be great to have an option in youtube-dl for this, so I mark this issue as a request.

if there any real 192kbps m4a audio in format 22, or it is always 128kbps with wrong 192kbps label...

For format 22 and other formats with both video and autio tracks, the bitrate value is not reliable. YouTube does not provide bitrate information for such formats, and the number is a guessed value from previous downloaded samples. You can find more guessed values in this table

@yan12125 commented on GitHub (Dec 9, 2016): > how to "rip" audio from 22 and combine it with 299 (as usual -f n+n) into one .mp4 ? As @iMrQuake said, currently you need to do that manually with ffmpeg. I guess it would be great to have an option in youtube-dl for this, so I mark this issue as a request. > if there any real 192kbps m4a audio in format 22, or it is always 128kbps with wrong 192kbps label... For format 22 and other formats with both video and autio tracks, the bitrate value is not reliable. YouTube does not provide bitrate information for such formats, and the number is a guessed value from previous downloaded samples. You can find more guessed values in [this table](https://github.com/rg3/youtube-dl/blob/c867adc/youtube_dl/extractor/youtube.py#L271-L366)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/youtube-dl-ytdl-org#9291
No description provided.