Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Announcements and Chat > General Discussion

Reply
 
Thread Tools Search this Thread Display Modes
Old 20th December 2009, 16:33   #1  |  Link
BlueToast
Registered User
 
BlueToast's Avatar
 
Join Date: Jul 2009
Location: Missouri, US
Posts: 68
ffmpeg -b -minrate -maxrate -bufsize

Quote:
`-b bitrate'
Set the video bitrate in bit/s (default = 200 kb/s).

`-maxrate bitrate'
Set max video bitrate (in bit/s). Requires -bufsize to be set.
`-minrate bitrate'
Set min video bitrate (in bit/s). Most useful in setting up a CBR encode:

ffmpeg -i myfile.avi -b 4000k -minrate 4000k -maxrate 4000k -bufsize 1835k out.m2v

It is of little use elsewise.
`-bufsize size'
Set video buffer verifier buffer size (in bits).
Source: http://ffmpeg.org/ffmpeg-doc.html (Section 3.3)

Alright! I want to have ffmpeg encode something at no more than 110 kbit/s (or kbps). I have tried '-b 110' but this does not work. A buddy and I did some research, and apparently you have to take advantage of minrate, maxrate, and bufsize (required for minrate and maxrate).

For clarification, "4000k" is "4000 kbit/s or kbps."

This is what I want to know: what is and exactly does bufsize do? What is "video buffer verifier buffer size" (someone please call the Department of Redundancy Department)?
__________________
Intel C2Q Q9450 Yorkfield 12MB L2-Cache @ 3.2GHz, G.Skill 2x2GB DDR2-1000 (PC2 8000) DC, Corsair 750TX, ATI VisionTek Radeon HD4850 512MB, 500GB Seagate Barracuda 7200.11 SATA-II, 200GB Maxtor IDE-150
BlueToast is offline   Reply With Quote
Old 20th December 2009, 17:40   #2  |  Link
Dark Shikari
x264 developer
 
Dark Shikari's Avatar
 
Join Date: Sep 2005
Posts: 8,666
Quote:
Originally Posted by BlueToast View Post
Source: http://ffmpeg.org/ffmpeg-doc.html (Section 3.3)

Alright! I want to have ffmpeg encode something at no more than 110 kbit/s (or kbps). I have tried '-b 110' but this does not work. A buddy and I did some research, and apparently you have to take advantage of minrate, maxrate, and bufsize (required for minrate and maxrate).

For clarification, "4000k" is "4000 kbit/s or kbps."

This is what I want to know: what is and exactly does bufsize do? What is "video buffer verifier buffer size" (someone please call the Department of Redundancy Department)?
There are so many things wrong here.

-b 110 means "110 bits per second". I don't think that's what you mean.

What do you mean by "no more than 110kbps"? Do you mean an average bitrate of 110kbps? That's what -b is for. Do you mean a local bitrate not exceeding 110kbps? If so, why?
Dark Shikari is offline   Reply With Quote
Old 20th December 2009, 17:44   #3  |  Link
BlueToast
Registered User
 
BlueToast's Avatar
 
Join Date: Jul 2009
Location: Missouri, US
Posts: 68
I am just trying to set the bitrate to 110kbps (the -b 110 would probably be more correct if I appended 'k' to '110'). In combination with a bitrate calculator, I am trying to make sure the encoded video will be around a specific filesize (such as 150 MB).

EDIT: Just tried it...but instead of displaying a bitrate of ~110kbps, it's all the way up to 300kbps (which is NOT what I want).
Quote:
frame= 1266 fps=158 q=24.8 Lsize= 1923kB time=50.64 bitrate= 311.1kbits/s
Using the following execution:
Quote:
ffmpeg -i FoldKora.mkv -b 110k -ar 44100 -ab 64 -f flv -s 240x180 FoldKora.flv
__________________
Intel C2Q Q9450 Yorkfield 12MB L2-Cache @ 3.2GHz, G.Skill 2x2GB DDR2-1000 (PC2 8000) DC, Corsair 750TX, ATI VisionTek Radeon HD4850 512MB, 500GB Seagate Barracuda 7200.11 SATA-II, 200GB Maxtor IDE-150

Last edited by BlueToast; 20th December 2009 at 17:47.
BlueToast is offline   Reply With Quote
Old 20th December 2009, 17:46   #4  |  Link
Dark Shikari
x264 developer
 
Dark Shikari's Avatar
 
Join Date: Sep 2005
Posts: 8,666
What you're looking to do has absolutely nothing to do with maxrate, minrate, or bufsize, and you should not be using those options.

Perhaps the reason that it's not giving you the bitrate you want is because your bitrate is below the lowest possible bitrate given the codec, qmax, and resolution?
Dark Shikari is offline   Reply With Quote
Old 20th December 2009, 17:54   #5  |  Link
BlueToast
Registered User
 
BlueToast's Avatar
 
Join Date: Jul 2009
Location: Missouri, US
Posts: 68
Well then how do I encode FoldKora.mkv (698 MB, 320x240, x264 codec / avc1 format, 25fps, ? bitrate, 128kbps MP3 @ 48000 Hz) to FLV (~150 MB, 240x180, 25fps, 64kbps audio @ 44100 Hz)?
__________________
Intel C2Q Q9450 Yorkfield 12MB L2-Cache @ 3.2GHz, G.Skill 2x2GB DDR2-1000 (PC2 8000) DC, Corsair 750TX, ATI VisionTek Radeon HD4850 512MB, 500GB Seagate Barracuda 7200.11 SATA-II, 200GB Maxtor IDE-150
BlueToast is offline   Reply With Quote
Old 20th December 2009, 18:11   #6  |  Link
Dark Shikari
x264 developer
 
Dark Shikari's Avatar
 
Join Date: Sep 2005
Posts: 8,666
FLV supports H.264; use x264 instead. Read the guide.
Dark Shikari is offline   Reply With Quote
Old 20th December 2009, 18:31   #7  |  Link
BlueToast
Registered User
 
BlueToast's Avatar
 
Join Date: Jul 2009
Location: Missouri, US
Posts: 68
Quote:
Originally Posted by Dark Shikari View Post
FLV supports H.264; use x264 instead. Read the guide.
So then I would put the following into a batch script:
Quote:
ffmpeg -i FoldKora.mkv -an -pass 1 -vcodec libx264 -vpre fastfirstpass -b 110k -bt 110k -threads 0 -s 240x180 FoldKoraFLV.mp4
ffmpeg -i FoldKora.mkv -acodec libfaac -ab 64k -pass 2 -vcodec libx264 -vpre hq -b 110k -bt 110k -threads 0 -s 240x180 FoldKoraFLV.mp4
__________________
Intel C2Q Q9450 Yorkfield 12MB L2-Cache @ 3.2GHz, G.Skill 2x2GB DDR2-1000 (PC2 8000) DC, Corsair 750TX, ATI VisionTek Radeon HD4850 512MB, 500GB Seagate Barracuda 7200.11 SATA-II, 200GB Maxtor IDE-150
BlueToast is offline   Reply With Quote
Old 21st December 2009, 02:32   #8  |  Link
Dark Shikari
x264 developer
 
Dark Shikari's Avatar
 
Join Date: Sep 2005
Posts: 8,666
Quote:
Originally Posted by BlueToast View Post
So then I would put the following into a batch script:
Yes, that should work. Or you can use .flv.

Do note for MP4, to make it "streamable", you have to use qt-faststart input.mp4 output.mp4.
Dark Shikari is offline   Reply With Quote
Old 21st December 2009, 20:00   #9  |  Link
BlueToast
Registered User
 
BlueToast's Avatar
 
Join Date: Jul 2009
Location: Missouri, US
Posts: 68
Thanks Dark Shikari!

One thought I was having -- if you or someone else could clear this up -- upon executing the first line in that batch, it would save a file FoldKoraFLV.mp4 (or FLV if I changed MP4). Then it would execute the second line after finishing that task -- wouldn't this overwrite FoldKoraFLV.mp4/flv and thus undo the first line's work? How do this part work?
__________________
Intel C2Q Q9450 Yorkfield 12MB L2-Cache @ 3.2GHz, G.Skill 2x2GB DDR2-1000 (PC2 8000) DC, Corsair 750TX, ATI VisionTek Radeon HD4850 512MB, 500GB Seagate Barracuda 7200.11 SATA-II, 200GB Maxtor IDE-150
BlueToast is offline   Reply With Quote
Old 21st December 2009, 20:07   #10  |  Link
J_Darnley
Registered User
 
J_Darnley's Avatar
 
Join Date: May 2006
Posts: 957
The first pass doesn't need to write a video file at all, it writes a stats file which contains the information needed for the second pass. When the second pass is run, this file is read.
__________________
x264 log explained || x264 deblocking how-to
preset -> tune -> user set options -> fast first pass -> profile -> level
Doom10 - Of course it's better, it's one more.
J_Darnley is offline   Reply With Quote
Old 17th January 2010, 23:55   #11  |  Link
BlueToast
Registered User
 
BlueToast's Avatar
 
Join Date: Jul 2009
Location: Missouri, US
Posts: 68
Finally got the opportunity to try this out.

ffmpeg.bat
Code:
ffmpeg -i hq700.mp4 -an -pass 1 -vcodec libx264 -vpre fastfirstpass -b 112k -bt 112k -threads 0 -s 240x180 lq150.mp4
ffmpeg -i hq700.mp4 -acodec libfaac -ab 64k -pass 2 -vcodec libx264 -vpre hq -b 112k -bt 112k -threads 0 -s 240x180 lq150.mp4
Code:
C:\Program Files (x86)\megui\tools\ffmpeg>ffmpeg.bat

C:\Program Files (x86)\megui\tools\ffmpeg>ffmpeg -i hq700.mp4 -an -pass 1 -vcode
c libx264 -vpre fastfirstpass -b 110k -bt 110k -threads 0 -s 240x180 lq150.mp4
FFmpeg version SVN-r20900-Sherpya, Copyright (c) 2000-2009 Fabrice Bellard, et a
l.
  built on Dec 20 2009 03:53:05 with gcc 4.2.5 20080919 (prerelease) [Sherpya]
  libavutil     50. 7. 0 / 50. 7. 0
  libavcodec    52.43. 0 / 52.43. 0
  libavformat   52.44. 0 / 52.44. 0
  libavdevice   52. 2. 0 / 52. 2. 0
  libavfilter    1.12. 0 /  1.12. 0
  libswscale     0. 7. 2 /  0. 7. 2
  libpostproc   51. 2. 0 / 51. 2. 0

Seems stream 0 codec frame rate differs from container frame rate: 50.00 (50/1)
-> 25.00 (25/1)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'hq700.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 1
    compatible_brands: isomavc1
  Duration: 01:57:19.56, start: 0.000000, bitrate: 833 kb/s
    Stream #0.0(und): Video: h264, yuv420p, 720x576 [PAR 1:1 DAR 5:4], 727 kb/s,
 50 fps, 25 tbr, 25k tbn, 50 tbc
    Stream #0.1(und): Audio: mp3, 48000 Hz, 2 channels, s16, 102 kb/s
File for preset 'fastfirstpass' not found

C:\Program Files (x86)\megui\tools\ffmpeg>ffmpeg -i hq700.mp4 -acodec libfaac -a
b 64k -pass 2 -vcodec libx264 -vpre hq -b 110k -bt 110k -threads 0 -s 240x180 lq
150.mp4
FFmpeg version SVN-r20900-Sherpya, Copyright (c) 2000-2009 Fabrice Bellard, et a
l.
  built on Dec 20 2009 03:53:05 with gcc 4.2.5 20080919 (prerelease) [Sherpya]
  libavutil     50. 7. 0 / 50. 7. 0
  libavcodec    52.43. 0 / 52.43. 0
  libavformat   52.44. 0 / 52.44. 0
  libavdevice   52. 2. 0 / 52. 2. 0
  libavfilter    1.12. 0 /  1.12. 0
  libswscale     0. 7. 2 /  0. 7. 2
  libpostproc   51. 2. 0 / 51. 2. 0

Seems stream 0 codec frame rate differs from container frame rate: 50.00 (50/1)
-> 25.00 (25/1)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'hq700.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 1
    compatible_brands: isomavc1
  Duration: 01:57:19.56, start: 0.000000, bitrate: 833 kb/s
    Stream #0.0(und): Video: h264, yuv420p, 720x576 [PAR 1:1 DAR 5:4], 727 kb/s,
 50 fps, 25 tbr, 25k tbn, 50 tbc
    Stream #0.1(und): Audio: mp3, 48000 Hz, 2 channels, s16, 102 kb/s
File for preset 'hq' not found
File for preset 'fastfirstpass' not found.
File for present 'hq' not found. X_x
__________________
Intel C2Q Q9450 Yorkfield 12MB L2-Cache @ 3.2GHz, G.Skill 2x2GB DDR2-1000 (PC2 8000) DC, Corsair 750TX, ATI VisionTek Radeon HD4850 512MB, 500GB Seagate Barracuda 7200.11 SATA-II, 200GB Maxtor IDE-150
BlueToast is offline   Reply With Quote
Old 18th January 2010, 01:31   #12  |  Link
Dark Shikari
x264 developer
 
Dark Shikari's Avatar
 
Join Date: Sep 2005
Posts: 8,666
On Windows you have to pass absolute paths to the presets, using -fpre.
Dark Shikari is offline   Reply With Quote
Old 18th January 2010, 02:56   #13  |  Link
BlueToast
Registered User
 
BlueToast's Avatar
 
Join Date: Jul 2009
Location: Missouri, US
Posts: 68
Where would these presents be?

EDIT: Been Googling it and looking everywhere in ffmpeg documentation and can't find that parameter..
__________________
Intel C2Q Q9450 Yorkfield 12MB L2-Cache @ 3.2GHz, G.Skill 2x2GB DDR2-1000 (PC2 8000) DC, Corsair 750TX, ATI VisionTek Radeon HD4850 512MB, 500GB Seagate Barracuda 7200.11 SATA-II, 200GB Maxtor IDE-150

Last edited by BlueToast; 18th January 2010 at 02:58.
BlueToast is offline   Reply With Quote
Old 18th January 2010, 07:06   #14  |  Link
Dark Shikari
x264 developer
 
Dark Shikari's Avatar
 
Join Date: Sep 2005
Posts: 8,666
Quote:
Originally Posted by BlueToast View Post
Where would these presents be?
The presets (.ffpreset files) come with ffmpeg.
Dark Shikari is offline   Reply With Quote
Old 18th January 2010, 18:15   #15  |  Link
BlueToast
Registered User
 
BlueToast's Avatar
 
Join Date: Jul 2009
Location: Missouri, US
Posts: 68
I don't have any ffpreset files. I am getting this ffmpeg.exe through MeGUI. I searched my harddrive for "*.ffpreset", "ffpreset", and "fastfirstpass" with no results for any. ffmpeg.org does not seem to have anything but SVN related downloads.
__________________
Intel C2Q Q9450 Yorkfield 12MB L2-Cache @ 3.2GHz, G.Skill 2x2GB DDR2-1000 (PC2 8000) DC, Corsair 750TX, ATI VisionTek Radeon HD4850 512MB, 500GB Seagate Barracuda 7200.11 SATA-II, 200GB Maxtor IDE-150
BlueToast is offline   Reply With Quote
Old 18th January 2010, 18:23   #16  |  Link
Dark Shikari
x264 developer
 
Dark Shikari's Avatar
 
Join Date: Sep 2005
Posts: 8,666
Quote:
Originally Posted by BlueToast View Post
I don't have any ffpreset files. I am getting this ffmpeg.exe through MeGUI. I searched my harddrive for "*.ffpreset", "ffpreset", and "fastfirstpass" with no results for any. ffmpeg.org does not seem to have anything but SVN related downloads.
Get the latest ffmpeg here.
Dark Shikari is offline   Reply With Quote
Old 18th January 2010, 19:57   #17  |  Link
BlueToast
Registered User
 
BlueToast's Avatar
 
Join Date: Jul 2009
Location: Missouri, US
Posts: 68
Alright. I have ffmpeg.exe and *.ffpreset files in E:\Videos\Teremtes\. In the same directory I have hq700.mp4 and ffmpeg.bat. Here is ffmpeg.bat:
Code:
ffmpeg -i hq700.mp4 -an -pass 1 -vcodec libx264 -fpre "C:\Program Files (x86)\megui\tools\ffmpeg\libx264-fastfirstpass.ffpreset" -b 112k -bt 112k -threads 0 -s 240x180 lq150.mp4
ffmpeg -i hq700.mp4 -acodec libfaac -ab 64k -pass 2 -vcodec libx264 -fpre "C:\Program Files (x86)\megui\tools\ffmpeg\libx264-hq.ffpreset" -b 112k -bt 112k -threads 0 -s 240x180 lq150.mp4
I change "-vpre" to "-fpre" and located the ffpreset file absolutely. It works, I'm just not sure if changing vpre to fpre is what I was supposed to do.
__________________
Intel C2Q Q9450 Yorkfield 12MB L2-Cache @ 3.2GHz, G.Skill 2x2GB DDR2-1000 (PC2 8000) DC, Corsair 750TX, ATI VisionTek Radeon HD4850 512MB, 500GB Seagate Barracuda 7200.11 SATA-II, 200GB Maxtor IDE-150
BlueToast is offline   Reply With Quote
Old 19th January 2010, 13:08   #18  |  Link
J_Darnley
Registered User
 
J_Darnley's Avatar
 
Join Date: May 2006
Posts: 957
Quote:
Originally Posted by BlueToast View Post
I change "-vpre" to "-fpre" and located the ffpreset file absolutely. It works, I'm just not sure if changing vpre to fpre is what I was supposed to do.
Yes, that is what you are supposed to do
__________________
x264 log explained || x264 deblocking how-to
preset -> tune -> user set options -> fast first pass -> profile -> level
Doom10 - Of course it's better, it's one more.
J_Darnley is offline   Reply With Quote
Old 25th January 2010, 18:04   #19  |  Link
BlueToast
Registered User
 
BlueToast's Avatar
 
Join Date: Jul 2009
Location: Missouri, US
Posts: 68
I ran the batch on two videos, and both of them turned out weird. I will explain what I mean by "weird" later. Is ffmpeg supposed to automatically mux in the audio to the resulting files? Another thing is that neither have audio like their high quality originals.
__________________
Intel C2Q Q9450 Yorkfield 12MB L2-Cache @ 3.2GHz, G.Skill 2x2GB DDR2-1000 (PC2 8000) DC, Corsair 750TX, ATI VisionTek Radeon HD4850 512MB, 500GB Seagate Barracuda 7200.11 SATA-II, 200GB Maxtor IDE-150
BlueToast is offline   Reply With Quote
Old 25th January 2010, 19:57   #20  |  Link
Dark Shikari
x264 developer
 
Dark Shikari's Avatar
 
Join Date: Sep 2005
Posts: 8,666
Quote:
Originally Posted by BlueToast View Post
I ran the batch on two videos, and both of them turned out weird. I will explain what I mean by "weird" later. Is ffmpeg supposed to automatically mux in the audio to the resulting files? Another thing is that neither have audio like their high quality originals.
FAAC at 64kbps sounds like crap? You don't say
Dark Shikari is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:18.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.