Stefan Deutschmann
Stefan Deutschmann

Reputation: 238

Youtube Stream fmt_stream_map Quality

I get the Stream URL by parsing "fmt stream map",

The problem is if my video duration is under 1 hour I get this:

{
"comment_count" = 1;
description = "";
"dislikes_num" = 0;
duration = "54:46";
"encrypted_id" = WWjNEyHrNsk;
"fmt_stream_map" =     (
            {
        "fallback_host" = "tc.v7.cache6.c.youtube.com";
        itag = 22;
        quality = hd720;
        type = "video/mp4; codecs=\"avc1.64001F, mp4a.40.2\"";
        url = "http://r4---sn-bvvbax-8pxl.c.youtube.com/videoplayback?sver=3&ipbits=8&itag=22&key=yt1&expire=1366039593&upn=phUk9-1Fjyw&signature=34CDFF5AAC4E5BB24177EAA001B5519E0218A04E.A437435FC87FD09D7AD95E0417A4EA77BC786C86&ms=au&mv=m&mt=1366015457&app=youtube_mobile&ip=85.127.44.131&fexp=906370%2C923120%2C932000%2C932004%2C906383%2C916911%2C916910%2C902000%2C901208%2C919512%2C929903%2C925714%2C931202%2C900821%2C900823%2C931203%2C906090%2C909419%2C908529%2C930807%2C919373%2C930803%2C906836%2C920201%2C929602%2C930101%2C930609%2C926403%2C900824&sparams=cp%2Cid%2Cip%2Cipbits%2Citag%2Cratebypass%2Csource%2Cupn%2Cexpire&el=watch&newshard=yes&id=5968cd1321eb36c9&cp=U0hVS1BOV19OTUNONV9ISEFGOmh3anpiZHFRODBI&dnc=1&yms=izkxzhrL53I&source=youtube&ratebypass=yes";
    },
            {
        "fallback_host" = "tc.v14.cache4.c.youtube.com";
        itag = 18;
        quality = medium;
        type = "video/mp4; codecs=\"avc1.42001E, mp4a.40.2\"";
        url = "http://r4---sn-bvvbax-8pxl.c.youtube.com/videoplayback?sver=3&ipbits=8&itag=18&key=yt1&expire=1366039593&upn=phUk9-1Fjyw&signature=BCA6FFE2575EE8947CFF52E91D0C8896538E239F.33FE7FF507257A8F5161A1E4C80A101BE4EB693F&ms=au&mv=m&mt=1366015457&app=youtube_mobile&ip=85.127.44.131&fexp=906370%2C923120%2C932000%2C932004%2C906383%2C916911%2C916910%2C902000%2C901208%2C919512%2C929903%2C925714%2C931202%2C900821%2C900823%2C931203%2C906090%2C909419%2C908529%2C930807%2C919373%2C930803%2C906836%2C920201%2C929602%2C930101%2C930609%2C926403%2C900824&sparams=cp%2Cid%2Cip%2Cipbits%2Citag%2Cratebypass%2Csource%2Cupn%2Cexpire&el=watch&newshard=yes&id=5968cd1321eb36c9&cp=U0hVS1BOV19OTUNONV9ISEFGOmh3anpiZHFRODBI&dnc=1&yms=izkxzhrL53I&source=youtube&ratebypass=yes";
    },
            {
        "fallback_host" = "tc.v3.cache3.c.youtube.com";
        itag = 36;
        quality = small;
        type = "video/3gpp; codecs=\"mp4v.20.3, mp4a.40.2\"";
        url = "http://r4---sn-bvvbax-8pxl.c.youtube.com/videoplayback?sver=3&ipbits=8&itag=36&key=yt1&expire=1366039593&upn=phUk9-1Fjyw&signature=8174E39396391843AFA940C30624A823E5275890.B323AA44059ED3928A47C4AEA1BC82F3C565F433&ms=au&mv=m&mt=1366015457&app=youtube_mobile&ip=85.127.44.131&fexp=906370%2C923120%2C932000%2C932004%2C906383%2C916911%2C916910%2C902000%2C901208%2C919512%2C929903%2C925714%2C931202%2C900821%2C900823%2C931203%2C906090%2C909419%2C908529%2C930807%2C919373%2C930803%2C906836%2C920201%2C929602%2C930101%2C930609%2C926403%2C900824&sparams=cp%2Cid%2Cip%2Cipbits%2Citag%2Cratebypass%2Csource%2Cupn%2Cexpire&el=watch&newshard=yes&id=5968cd1321eb36c9&cp=U0hVS1BOV19OTUNONV9ISEFGOmh3anpiZHFRODBI&dnc=1&yms=izkxzhrL53I&source=youtube&ratebypass=yes";
    }
);
"length_seconds" = 3286;
"likes_num" = 7;
longform = 1;
playability = "PLAY_OK";
"player_type" = desktop;
"profile_url" = "/user/KapfenbergWebTV";
"public_name" = KapfenbergWebTV;
"thumbnail_for_watch" = "http://i.ytimg.com/vi/WWjNEyHrNsk/hqdefault.jpg?w=600&h=360&sigh=5t9yhLmY66cc2ZBb6gJyOaNOsRs";
"thumbnail_info" = "<null>";
"time_created_text" = "Feb  6, 2013";
title = "HiWay-TV Sendung 3 - 2013";
"user_image_url" = "//s.ytimg.com/yts/img/silhouette32-vflu0yzhs.png";
"view_count" = "1,593";
"watch_link" = "/watch?v=WWjNEyHrNsk";
}

With different Qualities.

But if my video duration is over 1 hour, I only get small Quality like:

{
"comment_count" = 0;
description = "";
"dislikes_num" = 0;
duration = "1:00:47";
"encrypted_id" = taiK0WKSApg;
"fmt_stream_map" =     (
            {
        "fallback_host" = "tc.v1.cache6.c.youtube.com";
        itag = 36;
        quality = small;
        type = "video/3gpp; codecs=\"mp4v.20.3, mp4a.40.2\"";
        url = "http://r6---sn-bvvbax-8pxe.c.youtube.com/videoplayback?ratebypass=yes&fexp=906370%2C923120%2C932000%2C932004%2C906383%2C916911%2C916910%2C902000%2C901208%2C919512%2C929903%2C925714%2C931202%2C900821%2C900823%2C931203%2C906090%2C909419%2C908529%2C930807%2C919373%2C930803%2C906836%2C920201%2C929602%2C930101%2C930609%2C926403%2C900824&signature=9B83CFB7B240D7DA86E0ED4EC0DFFCFF4151D85B.81CBC92237B653BA3BF7E0E52A730B324EFD70A8&key=yt1&id=b5a88ad162920298&newshard=yes&mt=1366015334&sparams=cp%2Cid%2Cip%2Cipbits%2Citag%2Cratebypass%2Csource%2Cupn%2Cexpire&mv=m&ms=au&ip=85.127.44.131&el=watch&yms=izkxzhrL53I&itag=36&upn=j7RXkiXzhRI&source=youtube&cp=U0hVS1BOV19OUkNONV9ISEFHOm13anpiZHFROTBN&expire=1366039698&ipbits=8&sver=3&dnc=1&app=youtube_mobile";
    }
);
"length_seconds" = 3647;
"likes_num" = 6;
longform = 1;
playability = "PLAY_OK";
"player_type" = desktop;
"profile_url" = "/user/KapfenbergWebTV";
"public_name" = KapfenbergWebTV;
"thumbnail_for_watch" = "http://i.ytimg.com/vi/taiK0WKSApg/hqdefault.jpg?w=600&h=360&sigh=6hxibWtgHUAnZzNL9bBYxIQRScU";
"thumbnail_info" = "<null>";
"time_created_text" = "Apr  3, 2013";
title = "HiWay-TV Sendung 07 2013";
"user_image_url" = "//s.ytimg.com/yts/img/silhouette32-vflu0yzhs.png";
"view_count" = 974;
"watch_link" = "/watch?v=taiK0WKSApg";

}

Does anyone know where the Problem is??

Upvotes: 3

Views: 6995

Answers (2)

XBasic3000
XBasic3000

Reputation: 3486

duration doesn't matter. that video supports multiple format and qualities. you need to choose one that is available.

i have piece of my code base on ITAG hope this could help.

function GetScreenTag(iTag: Byte): String;
begin
  case iTag of
    5:  Result := 'Low Quality, 240p, FLV, 400x240';
    17: Result := 'Low Quality, 144p, 3GP, 0x0';
    18: Result := 'Medium Quality, 360p, MP4, 480x360';
    22: Result := 'High Quality, 720p, MP4, 1280x720';
    34: Result := 'Medium Quality, 360p, FLV, 640x360';
    35: Result := 'Standard Definition, 480p, FLV, 854x480';
    36: Result := 'Low Quality, 240p, 3GP, 0x0';
    37: Result := 'Full High Quality, 1080p, MP4, 1920x1080';
    38: Result := 'Original Definition, MP4, 4096x3072';
    43: Result := 'Medium Quality, 360p, WebM, 640x360';
    44: Result := 'Standard Definition, 480p, WebM, 854x480';
    45: Result := 'High Quality, 720p, WebM, 1280x720';
    46: Result := 'Full High Quality, 1080p, WebM, 1280x720';
    82: Result := 'Medium Quality 3D, 360p, MP4, 640x360';
    84: Result := 'High Quality 3D, 720p, MP4, 1280x720';
    100: Result := 'Medium Quality 3D, 360p, WebM, 640x360';
    102: Result := 'High Quality 3D, 720p, WebM, 1280x720';
    else
      Result := 'NA';
  end;
end;

Upvotes: 11

OmarElsherif
OmarElsherif

Reputation: 177

It doesn't depend on the duration, it depends on the available quality. If the quality is available, then there's a problem in parsing the (url_encoded_fmt_stream_map) block.

You can check this block and compare its contents with your parsing results. "url_encoded_fmt_stream_map": "..............."

Upvotes: 0

Related Questions