How to change Kbps to Mbps

Any questions? Need some help?
Post Reply
AleX69
Posts: 1
Joined: 09 Apr 2017, 06:11

How to change Kbps to Mbps

Post by AleX69 »

hi,
i use string:

Code: Select all

{n} {s00e00} {t}.{y}.{source.lower()}.{af.lower()}.{ac.lower()}.{video[0].frameRate}fps.{media.overallBitRateString.replaceAll(/ /)}.{vc.lower()}.{vf}
Big Little Lies S01E01 Somebody's Dead.2017.hdtv.2ch.ac3.fps.2479Kbps.x264.720p

I want to convert kbps to mbps, how to do it?
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: How to change Kbps to Mbps

Post by rednoah »

Here's how you get the bitrate in megabit, with and without decimals, and 2-decimal precision:

Code: Select all

{bitrate / 1e6}

Code: Select all

{bitrate / 1e6 as int}

Code: Select all

{(bitrate / 1e6d).round(2)}

EDIT:

{mbps} binding has been added with r5007.
:idea: Please read the FAQ and How to Request Help.
yhm28
Posts: 20
Joined: 24 Jan 2018, 07:20

Re: How to change Kbps to Mbps

Post by yhm28 »

rednoah wrote: 09 Apr 2017, 07:46 Here's how you get the bitrate in megabit, with and without decimals, and 2-decimal precision:

Code: Select all

{bitrate / 1e6}

Code: Select all

{bitrate / 1e6 as int}

Code: Select all

{(bitrate / 1e6d).round(2)}

EDIT:

{mbps} binding has been added with r5007.
so the correct groovy format to force Mbps (not Mb/s) with a single decimal would be +media.overallBitRateString.replace('/', 'p').XXXXXXX ?

any way to add framerate?
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: How to change Kbps to Mbps

Post by rednoah »

1.
You can use {mbps} for the first one.


2.
There is no convenience binding for the frame rate, so you'll have to grab it from the video stream directly:

Code: Select all

{video[0].FrameRate}
@see viewtopic.php?f=5&t=4285
:idea: Please read the FAQ and How to Request Help.
yhm28
Posts: 20
Joined: 24 Jan 2018, 07:20

Re: How to change Kbps to Mbps

Post by yhm28 »

rednoah wrote: 24 Jan 2018, 09:10 1.
You can use {mbps} for the first one.


2.
There is no convenience binding for the frame rate, so you'll have to grab it from the video stream directly:

Code: Select all

{video[0].FrameRate}
@see viewtopic.php?f=5&t=4285
I don't follow for the mbps. What is the exact code I would enter? Right now I am using

Code: Select all

+media.overallBitRateString.replace('/', 'p')
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: How to change Kbps to Mbps

Post by rednoah »

You can enter mbps. It's a top-level binding same as n or s00e00.
:idea: Please read the FAQ and How to Request Help.
Post Reply