media synchronization

Hello every body..

I do a simple application to transfer vedio from acamera and audio from amic over a network..

I use the RTPManager to send the audio track separated from the vedio track, BUT after test a found that audio received before vedio?!!!!!

I search for solution and i founde the JMF FAQ says thw following:

Q: What do I have to do to synchronize the audio and video streams if they are transmitted on separate RTP sessions?

JMF supports audio and video synchronization over RTP based on the model specified in the RTP spec. Each RTP data stream is matched with the corresponding RTCP stream to correctly determine the media timestamps. That is then used to synchronize the streams sent from the same user as identified by the cname (canonical name) of that user. Even when the streams are sent from different sessions (RTPManager), the streams from the same user will be synchronized as long as the streams all carry the same cname.

So from the programming point of view, if you create two sessions (RTPManager's) for audio and video, you'll need to make sure both sessions are initialized with the same cname (inside SourceDescription) in order to guarantee A/V synchronization.

Check the AVTransmit on the solutions page for more detail: http://java.sun.com/products/java-media/jmf/2.1.1/solutions/AVTransmit.html

So can any body give me a feed back or an example to clarify the cname and RTCP so i can solve my problem?!!!

Please help me!!!

Regards...

[1553 byte] By [shadya] at [2007-11-26 14:13:51]
# 1

hi shady,

here's what i found : "CNAME is normally used in older JMF RTP API(javax.media.rtp.SessionManager), with the new one(javax.media.rtp.RTPManager) , CNAME can be handled internally."

This means that your CNAME (canonical name) is already handled by RTPManager and it is the same for video and audio. For instance, CNAME for one PC will always be shady@mypc (in my case CNAME for my desktop is always Andrey@ratm). Which means, that it is already set for you. From here it follows, that synchronization doesnt work in JMF.

If I were you, i wouldnt bother about trying to sync audio and video (i know I dont do it). From my experience, learners need video no matter what quality or rate it is just FOR REFERENCE. What they need much more is audio, shared slides and a group chat. Those 3 you must focus on.

andreyvka at 2007-7-8 2:03:03 > top of Java-index,Security,Cryptography...
# 2

Firstly>>Thanks Mr. andry for ur reply..

ur feedback about CNAME is very good and according to what u say i can't synchronize the vedio and audio according to CNAME...

But i think for an idea to do the synchronization manually.. may be by sending some flags at begining of transmition and other at the mid of thransmition and other at the end,,, and according to these flags i will sychronize the media...

But now i don't knew how can i get the timestamp of the audio stream and vedio stream at any time i need ?

Also how can i told the srever side to prevent any track media to appear at some time stamp ?

I hope u understand my idea!! if not i can clarify more..

i excuse u for my english language..

I wait for reply...

shadya at 2007-7-8 2:03:03 > top of Java-index,Security,Cryptography...
# 3

I understand what you need.

1. Unfortunatelly, I dont know how to play with timestamps in RTP. All I know is that timestamp can be set with Buffer class. In general, you have to "manually" transmit video/audio Buffer by Buffer. I really dont know how it's done in details, but something to do with implementing your own Push/PullDataSource. On the receiver's side, you will receive audio/video, extract timestamps and sync your media streams. One thing i know for sure is that this is a hell of a job.

Can someone, plz, suggest something to shady on RTP timestamps in JMF? I remember there was some sort of example on this, but dont remember where.. :(

2. Could you, please, tell my WHY audio/video synchronization is so important for you? I still dont understand..

andreyvka at 2007-7-8 2:03:03 > top of Java-index,Security,Cryptography...
# 4

Thanks for reply mr andry,,,

I hope any one hear ur request at the forums and help us at my problem..

for what ur ask>> The project i have now has amain part which is let the audio and vedio be synchronize,, and i must do it or i will lose the project,, this thing not my choise...

I Hope u estimate the problem i have now?

I hope i found any help..

shady,,

shadya at 2007-7-8 2:03:04 > top of Java-index,Security,Cryptography...
# 5

shady.. one request though.. plz, dont call me Mr... im barely your age.

anyway, hope i could be of better help... can someone, please, help shady on using Buffers?

anyway, take a look at JMF solutions (http://java.sun.com/products/java-media/jmf/2.1.1/solutions/) maybe some of them can give you a clue.

btw, was it you who had problems merging video and audio into a single data source?

andreyvka at 2007-7-8 2:03:04 > top of Java-index,Security,Cryptography...
# 6
hehe... i finally found what i was searching for... accessing frames individually :) http://java.sun.com/products/java-media/jmf/2.1.1/solutions/FrameAccess.htmlthis can help. check it out
andreyvka at 2007-7-8 2:03:04 > top of Java-index,Security,Cryptography...
# 7

Thanks andry for ur reply, and am sorry about saying mr but i thought this thing represent my respect to whom help me..

1) and about what u said about merging>> yes i have athread before about this subject.... and if u want any help i can do for u...

2) about the frame acces example i had it before but it not help me about time stamp..

i wait any reply for time stamp handling with buffer..

shadya at 2007-7-8 2:03:04 > top of Java-index,Security,Cryptography...
# 8
Hello,Is My problem haven't any solution?If yes please reply to me...If no please help me..Don't let me wait and no body reply..Thanks..
shadya at 2007-7-8 2:03:04 > top of Java-index,Security,Cryptography...
# 9

hijo lo que queres hacer es una manteca... no te enrolles es muy facil asi como esta en el codigo ejemplo asi tenes que seguir....

mira..

if (controllerEvent instanceof RealizeCompleteEvent) {

System.out.println("controllerUpdate..........[ControllerEvent controllerEvent] ");

System.out.println("- RealizeCompleteEvent ");

PlayerWindow pw = find(p);

if (pw == null) {

// Some strange happened.

System.err.println("Internal error!");

System.exit(-1);

}

String ssrc = getSSRCFromPlayer(p);

PlayerHash pHash = (PlayerHash)players.get(ssrc);

if (p == pHash.playerVideo){

System.out.println("- Video player initilized");

pHash.playerVideoInit = true;

} else {

System.out.println("- Audio player initilized");

pHash.playerAudioInit = true;

}

pw.initialize();

if (pw.getFormat() instanceof VideoFormat){

pw.setVisible(true);

}

//p.start();

if (pHash.playerVideoInit && pHash.playerAudioInit){

try {

pHash.playerAudio.setTimeBase(pHash.playerVideo.getTimeBase());

pHash.playerAudio.addController(pHash.playerVideo);

pHash.playerAudio.setRate(1F);

pHash.playerAudio.start();

} catch (IncompatibleTimeBaseException ex) {

ex.printStackTrace();

}

}

}

culosabrosoa at 2007-7-8 2:03:04 > top of Java-index,Security,Cryptography...
# 10
marco.montilla@gmail.com
culosabrosoa at 2007-7-8 2:03:04 > top of Java-index,Security,Cryptography...
# 11
dear culosabroso,i don't understand ur language please write to me in english language please..
shadya at 2007-7-8 2:03:04 > top of Java-index,Security,Cryptography...
# 12
i want english progamms.
a-b@1969a at 2007-7-8 2:03:04 > top of Java-index,Security,Cryptography...
# 13
i want a jop.
a-b@1969a at 2007-7-8 2:03:04 > top of Java-index,Security,Cryptography...