Skip to main content
Topic: Problem detecting MP2/MP1 with variable bit rate (Read 6286 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Problem detecting MP2/MP1 with variable bit rate

Greetings!

I was wondering how to check if an MP2 file is VBR or CBR. MP3s have that Xing or VBRI tag which is used to hold some enhanced information and to tell the decoder that the played file is VBR.
The only way I can think of doing that would be to scan the frames of an MP2 file until I detect a bitrate change in the frame's header, but that could take a long time if the MP2 is big and CBR (as the program will go through all frames hoping to find a different bitrate).

Thank you in advance!

PS: I know that MP2 files can be VBR, but what about MP1?

Problem detecting MP2/MP1 with variable bit rate

Reply #1
Quote
MP3s have that Xing or VBRI tag which is used to hold some enhanced information and to tell the decoder that the played file is VBR.
Not always, this tags are not needed and are not in the specs. But many players assume it´s CBR if this tag is not present and show the length not correctly.
Quote
The only way I can think of doing that would be to scan the frames of an MP2 file until I detect a bitrate change in the frame's header, but that could take a long time if the MP2 is big and CBR (as the program will go through all frames hoping to find a different bitrate).
Yes, this is the only way, but it shouldn´t take that long, you open a file, scan first bitrate, calculate next header position, jump there and scan it... For a normal file (~5MB) it should take not more than a second I think. Also you don´t need to scan all frames, if you don´t find a bitrate change in the first 100 frames, it´s most likely CBR (except there is a lot of digital silence at the beginning).
Quote
PS: I know that MP2 files can be VBR, but what about MP1?

Theoretically it could be possible, but if there is any mpeg-layer1 encoder able to encode VBR, I don´t know. I know mp2 decoders don´t need to support VBR, but it is allowed, but I don´t know for layer1, but most likely decoders don´t need to support it.

Problem detecting MP2/MP1 with variable bit rate

Reply #2
OK, thanks for the information. :-)

One more thing: Do you know how to detect a MP3pro file? Someone told me that I have to look at the ancillary data, but I don't know how to do that. Isn't there an easier way of doing that?

Problem detecting MP2/MP1 with variable bit rate

Reply #3
Quote
One more thing: Do you know how to detect a MP3pro file? Someone told me that I have to look at the ancillary data, but I don't know how to do that. Isn't there an easier way of doing that?

No, I don´t think so. Because ATM the matroska team has the same problem, how to detect HE-AAC (AAC+SBR). There is no easy way to detect it, too.

Problem detecting MP2/MP1 with variable bit rate

Reply #4
Hi,
  I know this thread is ancient but I wondered if anyone had source code of the MP1 video codec. Ideally the VBR version but right now, ANY would be a big help.

With thanks,
Sean
Thanks for the help!

Problem detecting MP2/MP1 with variable bit rate

Reply #5
Just check out ffmpeg sources?
"I hear it when I see it."

Problem detecting MP2/MP1 with variable bit rate

Reply #6
I know this thread is ancient but I wondered if anyone had source code of the MP1 video codec. Ideally the VBR version but right now, ANY would be a big help.


Are you still looking for information on video decoding on the SA-1110?  If so, you might be interested in the Rockbox mpegplayer plugin:

http://www.rockbox.org/wiki/PluginMpegplayer

It is heavily optimized for ARM processors and does mpeg audio/video decoder at about 24 fps for an ARM9 core, which is fairly similar to your strongarm processor.  You can find the source here:

http://git.rockbox.org/?p=rockbox.git;a=tr...560fc37;hb=HEAD

Re: Problem detecting MP2/MP1 with variable bit rate

Reply #7
I know this thread is ancient but I wondered if anyone had source code of the MP1 video codec. Ideally the VBR version but right now, ANY would be a big help.

Are you still looking for information on video decoding on the SA-1110?  If so, you might be interested in the Rockbox mpegplayer plugin:

http://www.rockbox.org/wiki/PluginMpegplayer

It is heavily optimized for ARM processors and does mpeg audio/video decoder at about 24 fps for an ARM9 core,375 which is fairly similar to your strongarm processor.  You can find the source here:

http://git.rockbox.org/?p=rockbox.git;a=tr...560fc37;hb=HEAD

I try the above and  I try these steps video decoding:
Go into Media menu, Convert/Save, and add the input file to the File Selection. Click Convert/Save to open the Profiles selector.
Create a new profile and choose:
Encapsulation = MPEG-PS
Video codec = MPEG-2 (set width and height for your player)
Audio codec = MP3, Sample Rate = 44100
Save the profile for future use.
Click Start
Command Line

Open a command line prompt and go to the VLC installation directory (default is C:\Program Files\VideoLAN\VLC\ ). Run the following command line:
vlc <input> :sout=#transcode{vcodec=mp2v,vb=600,width=<the width>,height=<the height>,
acodec=mp3,ab=128,samplerate=44100,audio-sync}:std{access=file,mux=ps,dst=<filename>.mpg}
Note: You'll need to add quotes around #transcode{....}:std{...} on Linux or OS X.
Note: For versions before 0.8.6 you will need to change ":sout" to "--sout" and "dst" to "url".
vb stands for "video bitrate in kbits/sec". 600 kbits/sec should be good enough for most targets ... you might want to try a lower value for small screens.
ab stands for "audio bitrate in kbits/sec" and samplerate is the audio samplerate in Hz. Currently (2nd January 2007), MPEGplayer only supports 44.1KHz audio.
Important: mpeg2 allows only some very specific framerates. If encoding fails, it's likely that your source framerate doesn't comply. To change the frame rate, add fps=25 or fps=29.97 in transcode{...}. (This applies to the following .bat file too)
A convenient way for Windows users to achieve the same result is to use VLC-transcode.bat. Simply save this file somewhere and drag&drop a video onto it and it will be transcoded using the above settings. You will probably want to edit the file to change width and height (default is 320x240).



 
SimplePortal 1.0.0 RC1 © 2008-2018