aMSN Forums
May 26, 2013, 06:31:33 am *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: New forum for aMSN !!
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: aMSN webcam quality  (Read 11714 times)
baron
Newbie

Offline Offline

Posts: 6


View Profile WWW
« on: December 12, 2007, 07:26:20 pm »

Hi, I've noticed that when using aMSN to send webcam the quality doesn't seem to be as good as in MSN.

I did a little investigating, and it seems that while in aMSN source the webcam DLL exposes a method to change the quality, I don't think (from a quick look, I'm not familiar with TCL) that the calling code is setting the quality, so it's going to the default, which is zero quality. MSN messenger seems to set this to a higher quality (I just did a test and this was at 4500 on a test file).

Am I barking up the wrong tree here .. or could this be a slight oversight? If it was unintentional it would be very easy to fix. Smiley

/edit
Well as no one has answered .. here's how I fixed on my build (0.97RC1):
1) Went into msncam.tcl
2) Found proc Grab_Windows (I'm on windows, you would fix the proc for your platform)
3) Added a line to set the quality

set encoder [::Webcamsn::NewEncoder HIGH]
setObjOption $socket codec $encoder

#add this line
::Webcamsn::SetQuality $encoder 4500

I've never used tcl/tk but this seems to be working according to my tests.
Logged
Kreuger
Super Power User
**
Offline Offline

Posts: 204


View Profile WWW
« Reply #1 on: December 14, 2007, 03:23:07 pm »

I thought the quality was dependant on the webcam and their internet connection?! Interesting to know that the client can also affect it.
Logged
kakaroto
Administrator
Super Power User
*****
Offline Offline

Posts: 9428


View Profile WWW
« Reply #2 on: December 14, 2007, 11:02:48 pm »

Hi baron,
Noone ever complained.. but hey, you must be right!
At first, when I saw the post, I thought "oh no, not another one complaining about the webcam", then I thought you were refering to the quality of the captured image, and I was thinking you were mad.. then I understood you were talking about the quality of the mimic encoder, and it makes sense. I guess we thought that the default quality used by libmimic was the same as the one used by MSN. And iirc, I did test different qualities and saw no difference, so I thought that it doesn't make any difference.
I just checked, and the default quality is indeed 0 (defined in mimic-private.h).
Anyways, I now changed this in SVN revision 9119 for all platforms.
Thanks for finding this.
@Kreuger: the quality of the image is dependant on the webcam, the quality of the *encoded* image is dependent on the codec used (the one used by msn is mimic and it has a configurable quality for the encoding), and the framerate is dependent on the internet connection.
Logged

KaKaRoTo
baron
Newbie

Offline Offline

Posts: 6


View Profile WWW
« Reply #3 on: December 14, 2007, 11:47:37 pm »

glad to have helped! Cheesy
Logged
square87
Super Power User
**
Offline Offline

Posts: 427


View Profile
« Reply #4 on: December 15, 2007, 11:43:46 am »

Hi Baron
I knew about that behavior, but i didn't know how to resolve it.
How do you find that value? Tongue

Anyway thanks!
Logged
baron
Newbie

Offline Offline

Posts: 6


View Profile WWW
« Reply #5 on: December 15, 2007, 12:48:08 pm »

Quote from: "square87"
Hi Baron
I knew about that behavior, but i didn't know how to resolve it.
How do you find that value? Tongue

Anyway thanks!


Hmm, well it's easy for me as I can debug through my ML20viewer lol ... but for mortals: Tongue

If you look through a captured .cam file in a hex editor, and find an 'ML20' fourcc in the stream. This is part of the external frame header:

   unsigned char m_ucHeaderSize;// 0
   unsigned char m_ucIsPauseFrame; // 1
   unsigned short m_usWidth; // 2
   unsigned short m_usHeight; // 4
   unsigned short m_usIsKeyframe; // 6
   unsigned int m_uiPayloadSize; // 8
   unsigned int m_uiFCC; // ML20 // 12
   unsigned int m_uiUniqueRandomID; // 16
   unsigned int m_uiTimestamp; // 20

Just past this you get to the frame data, and bytes 2-3 of this are the quality setting of the internal frame header, see:

http://wiki.multimedia.cx/index.php?title=ML20

So the 2 bytes for the quality start at 10 bytes past the end of the ML20 fourcc. '9411' would indicate 4500 (1194 in hex). You may also be able to step through the webcam DLL source if you have that handy.

Incidently, it is possible that the MSN client adjusts this value, however in the captures I've tried from MSN clients on other machines it has always been 4500 ... whether that is a function of my bandwidth I don't know.

If you need to capture aMSN's output you can use Wireshark or MSN webcam recorder. I run MSN and aMSN at the same time on the same machine camming from one to the other to test.
Logged
kakaroto
Administrator
Super Power User
*****
Offline Offline

Posts: 9428


View Profile WWW
« Reply #6 on: December 15, 2007, 01:47:52 pm »

hehe, baron, great method for finding out the quality used by MSN.. I would have dug into its code instead of looking at the generated cam stream, lol..
in any case, I just took a quick look into the webcam dll of msn, and it seems to be using '4500' for something when creating the cam stream.. I guess it's the quality... (it actually calls some unknown function giving it a few paramters.. 'ML20' as the first parameter, 4500 as the 3rd.. So we can assume it's hardcoded (otherwise, it wouldn't appear hardcoded in the code, it would be 'calculated' depending on the bandwidth you have).
Logged

KaKaRoTo
square87
Super Power User
**
Offline Offline

Posts: 427


View Profile
« Reply #7 on: December 15, 2007, 09:39:08 pm »

Hi Baron
Thanks for explanation and for that link!
I tried with KHexEdit and i saw that value Tongue and with an amsn video cam i got 0000

Bye
Logged
Kreuger
Super Power User
**
Offline Offline

Posts: 204


View Profile WWW
« Reply #8 on: December 17, 2007, 04:30:41 am »

Quote
@Kreuger: the quality of the image is dependant on the webcam, the quality of the *encoded* image is dependent on the codec used (the one used by msn is mimic and it has a configurable quality for the encoding), and the framerate is dependent on the internet connection.
Makes sense but seeing as I've never done it I wouldn't know otherwise Tongue. Now I do Smiley
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!