Asked  6 Months ago    Answers:  5   Viewed   37 times

I was using YouTube videos for my test and I was wondering how can I get the information of bit-rate of the played video?

I used 2 methods to know the information about the bit-rate but didn't get any information.

1. Right-click on a video and choose "Stats for nerds".
2. ffmpeg -i input_video -f ffmetadata metadata.txt

I don't know if by doing the right click on the video and then properties, then details would give me the correct way of showing the bit-rate.

Any suggestions?



Most YouTube video use adaptive bit rate (ABR) format streaming which means that there is not just a single bit rate.

For ABR multiple bit rate versions of the video are created and each one is broken down into equal length (by time) chunks - e.g. 10 second chunks.

The client player is then able to select the next chunk from the most appropriate bit rate stream for the current network conditions - if the network gets busy it can drop down to a lower bit rate for the next chunk and visa versa if the network is good.

So there is not really the concept of a single bit rate for the whole video, but different bit rates for each chunk that is downloaded (although in practice if you have a good connection it should work up to the top bit rate and stay there).

As you say, you can see a visualisation of this on YouTube by right clicking and looking at the 'stats for nerds' option - see example below:

enter image description here

You can also see the available resolutions, and force the player to select a single one by clicking on the 'wheel' in the bottom right hand corner. As a general rule, a higher resolution will need a higher number of bits and hence mean a higher bit rate,

To see a more detailed view of the video buffers and the bitrate, some players provide a demo view with a representation of the change over time - see below an example from the DASH IF reference player (

enter image description here

Tuesday, June 1, 2021
answered 6 Months ago

Here's a example using the YouTube RSS feeds, simplexml_load_file, parse_url, and parse_str.


$id = NULL;
$username = 'YouTube';

$xml = simplexml_load_file(sprintf('', $username));

if ( ! empty($xml->channel->item[0]->link) )
  parse_str(parse_url($xml->channel->item[0]->link, PHP_URL_QUERY), $url_query);

  if ( ! empty($url_query['v']) )
    $id = $url_query['v'];

echo $id; // Outputs the video ID.
Wednesday, March 31, 2021
answered 9 Months ago

This is a bug in the interplay between youtube-dl and ffmpeg, caused by the lack of extension in the filename. youtube-dl calls ffmpeg. Since the filename does not contain any extension, youtube-dl asks ffmpeg to generate a temporary file mp3. However, ffmpeg detects the output container type automatically by the extension and fails because mp3 has no extension.

As a workaround, simply add %(ext)s in your filename template:

'outtmpl': u'%(id)s.%(ext)s',
Friday, August 6, 2021
answered 4 Months ago

_isFullScreen inside public void onFullscreen(boolean _isFullScreen) is state of full screen, if it's true it means player is gone to full screen mode and if it is false it means the player is switched back from full screen mode and this listener is called both times when you go to full screen mode and come back from full screen mode with true and false value respectively. You should modify code as below

videoPlayer.setOnFullscreenListener(new OnFullscreenListener() {

        public void onFullscreen(boolean _isFullScreen) {
            fullScreen = _isFullScreen;
            textView.setVisibility(View.GONE); // hide text as player switched to full screen mode
            } else {
            textView.setVisibility(View.VISIBLE); // show text as player switched back from full screen mode, changing visibility here instead of onBackPressed have advantage that even if user switches back from full screen mode using control button on player instead of press back button the text will still come to visible

while your onBackPressed listener will be just used for switching player back from full screen mode if player was in full screen mode when back button was pressed;

public void onBackPressed() {
if (fullScreen){

} else{
Saturday, August 21, 2021
answered 4 Months ago

Here's the general procedure:

1) Get the "watch History" playlist of a given user's channel (as a channel ID is the key to getting user info). Note that this will ONLY work when a user is authenticated via oAuth2.{YOUR_API_KEY}

With that response, there should be a "watchHistory" playlist ... take it and call the playlistItems endpoint:{YOUR_API_KEY}

Unfortunately, many users are reporting there's a bug in the watch history playlist through the API right now:

So your mileage may vary.

Saturday, September 4, 2021
answered 3 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :