Video resolution for live YouTube stream
Posted: 06 Jan 2018 19:02
I have used information from the forum to write a C++ app that displays live YouTube streams. For every live YouTube URL I've tried to use, I always receive 256x144 video but I know other resolutions are available. Here is output from youtube-dl that shows 6 available resolutions for the popular NASA live channel.
$ youtube-dl -F RtU_mdL2vBM -v
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: [u'-F', u'RtU_mdL2vBM', u'-v']
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2017.12.31
[debug] Python version 2.7.12 - Linux-4.10.0-42-generic-x86_64-with-Ubuntu-16.04-xenial
[debug] exe versions: ffmpeg 3.3.3-2, ffprobe 3.3.3-2, rtmpdump 2.4
[debug] Proxy map: {}
[youtube] RtU_mdL2vBM: Downloading webpage
[youtube] RtU_mdL2vBM: Downloading video info webpage
[youtube] RtU_mdL2vBM: Extracting video information
[youtube] RtU_mdL2vBM: Downloading m3u8 information
[youtube] RtU_mdL2vBM: Downloading MPD manifest
[info] Available formats for RtU_mdL2vBM:
format code extension resolution note
91 mp4 256x144 HLS 197k , avc1.42c00b, 30.0fps, mp4a.40.5@ 48k
92 mp4 426x240 HLS 338k , avc1.4d4015, 30.0fps, mp4a.40.5@ 48k
93 mp4 640x360 HLS 829k , avc1.4d401e, 30.0fps, mp4a.40.2@128k
94 mp4 854x480 HLS 1380k , avc1.4d401f, 30.0fps, mp4a.40.2@128k
95 mp4 1280x720 HLS 2593k , avc1.4d401f, 30.0fps, mp4a.40.2@256k
96 mp4 1920x1080 HLS 4715k , avc1.640028, 30.0fps, mp4a.40.2@256k (best)
However, using the usual method based on extracting the first libvlc_media_t item from a libvlc_media_list_t list (note that libvlc_media_list_count() says there is only one item in the list), I always get the lowest resolution. Below is the MRL for the libvlc_media_t item that is in position 0 in the list.
https://manifest.googlevideo.com/api/ma ... 35.124.33/itag/0/ei/WwZRWt6QNrishwbS-aeoDA/maudio/1/hfr/1/ipbits/0/signature/6014B5FB2BCAD858AF9429921A3F89AE05A41D43.3DB953211F5956EA7CC0BCA76BE5233DFBCE7240/playlist_type/DVR/dover/8/keepalive/yes/playlist_duration/30/manifest_duration/30/file/index.m3u8
I think the itag/0 field results in selection of a default resolution. I would like to use format code 93 shown in the youtube-dl output. Is there any way I can do that programming with the libvlc API?
$ youtube-dl -F RtU_mdL2vBM -v
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: [u'-F', u'RtU_mdL2vBM', u'-v']
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2017.12.31
[debug] Python version 2.7.12 - Linux-4.10.0-42-generic-x86_64-with-Ubuntu-16.04-xenial
[debug] exe versions: ffmpeg 3.3.3-2, ffprobe 3.3.3-2, rtmpdump 2.4
[debug] Proxy map: {}
[youtube] RtU_mdL2vBM: Downloading webpage
[youtube] RtU_mdL2vBM: Downloading video info webpage
[youtube] RtU_mdL2vBM: Extracting video information
[youtube] RtU_mdL2vBM: Downloading m3u8 information
[youtube] RtU_mdL2vBM: Downloading MPD manifest
[info] Available formats for RtU_mdL2vBM:
format code extension resolution note
91 mp4 256x144 HLS 197k , avc1.42c00b, 30.0fps, mp4a.40.5@ 48k
92 mp4 426x240 HLS 338k , avc1.4d4015, 30.0fps, mp4a.40.5@ 48k
93 mp4 640x360 HLS 829k , avc1.4d401e, 30.0fps, mp4a.40.2@128k
94 mp4 854x480 HLS 1380k , avc1.4d401f, 30.0fps, mp4a.40.2@128k
95 mp4 1280x720 HLS 2593k , avc1.4d401f, 30.0fps, mp4a.40.2@256k
96 mp4 1920x1080 HLS 4715k , avc1.640028, 30.0fps, mp4a.40.2@256k (best)
However, using the usual method based on extracting the first libvlc_media_t item from a libvlc_media_list_t list (note that libvlc_media_list_count() says there is only one item in the list), I always get the lowest resolution. Below is the MRL for the libvlc_media_t item that is in position 0 in the list.
https://manifest.googlevideo.com/api/ma ... 35.124.33/itag/0/ei/WwZRWt6QNrishwbS-aeoDA/maudio/1/hfr/1/ipbits/0/signature/6014B5FB2BCAD858AF9429921A3F89AE05A41D43.3DB953211F5956EA7CC0BCA76BE5233DFBCE7240/playlist_type/DVR/dover/8/keepalive/yes/playlist_duration/30/manifest_duration/30/file/index.m3u8
I think the itag/0 field results in selection of a default resolution. I would like to use format code 93 shown in the youtube-dl output. Is there any way I can do that programming with the libvlc API?