[Red5] H.264 Flash dont Play - Debug Player?

Paulo henrique França Silva phmasters at hotmail.com
Thu Sep 3 14:15:14 PDT 2009



I found the reason that videos with less than 60 frames doesn't play. All because the bufferTime of Flash. If the video dont fill up the buffer, nothing happens.
But the big problem is the fact that mp4 vídeos generated by xuggle doesn't play. No matter the bitrate of the video


 
From: phmasters at hotmail.com
To: red5 at osflash.org
Date: Thu, 3 Sep 2009 20:49:06 +0000
Subject: Re: [Red5] H.264 Flash dont Play - Debug Player?








to help you to help me( heheh) the class of the RTMPClient that I used was:

public class ClienteRTMP extends RTMPClient implements INetStreamEventHandler, ClientExceptionHandler, IPendingServiceCallback {

    public boolean startPublish = false;
    
    public Integer publishStreamId;
    private String publishName;
    
    private RTMPConnection conn;
    //private ITagWriter writer;
    //private ITagReader reader;
    private int videoTs = 0;
    private int audioTs = 0;
    private int kt = 0;
    private int kt2 = 0;
    private IoBuffer bufferAudio;
    private IoBuffer bufferVideo;
    private boolean enviouVideo=false;
    private final Collection<IStreamEvent> mListeners = new CopyOnWriteArrayList<IStreamEvent>();
    public interface IStreamEvent {
        public void onStreamStart();
    }
    private Collection<IStreamEvent> getListeners() {
        return Collections.unmodifiableCollection(mListeners);
    }

    private void onStartStream() {
        
        for (IStreamEvent listener : getListeners()) {
            listener.onStreamStart();
        }
    }
    public void addEventlistener(IStreamEvent listener){
     mListeners.add(listener);
    }
    
    // ------------------------------------------------------------------------
    //
    // Overide
    //
    // ------------------------------------------------------------------------
    @Override
    public void connectionOpened(RTMPConnection conn, RTMP state) {


        super.connectionOpened(conn, state);
        this.conn = conn;
    }

    @Override
    public void connectionClosed(RTMPConnection conn, RTMP state) {


        super.connectionClosed(conn, state);
    }

    @Override
    protected void onInvoke(RTMPConnection conn, Channel channel, Header header, Notify notify, RTMP rtmp) {

        super.onInvoke(conn, channel, header, notify, rtmp);

        try {
            ObjectMap<String, String> map = (ObjectMap) notify.getCall().getArguments()[ 0];
            String code = map.get("code");

            if (StatusCodes.NS_PLAY_STOP.equals(code)) {
                disconnect();
            }else if (StatusCodes.NS_PUBLISH_START.equals(code)) {
                startPublish = true;
                this.onStartStream();
        }
        } catch (Exception e) {
        }

    }


    // ------------------------------------------------------------------------
    //
    // Public
    //
    // ------------------------------------------------------------------------

    public void startStream(String host, String app, int port, String publishName,  String user, String password) {

        this.publishName = publishName;
        startPublish = false;

        videoTs = 0;
        audioTs = 0;
        kt = 0;
        kt2 = 0;
         ObjectMap<String, Object> params = new ObjectMap<String, Object>();
         params.put("app", app);
         params.put("flashVer", "WIN 9,0,16,0");
         params.put("tcUrl", "rtmp://"+app+"/"+app);
         params.put("username", user);
         params.put("password", password);
        try {
            Object[] obj = new Object[] { user,password };
            connect(host, port, params, this, obj);
            setStreamEventDispatcher(new PlayNetStream());

        } catch (Exception e) {
        }

    }

    public void stopStream() {

        System.out.println("RTMPUser stopStream");

        try {
            disconnect();
        } catch (Exception e) {
        }

    }


    // ------------------------------------------------------------------------
    //
    // Implementations
    //
    // ------------------------------------------------------------------------
     public void onStreamEvent(Notify notify) {



        ObjectMap map = (ObjectMap) notify.getCall().getArguments()[ 0];
        String code = (String) map.get("code");

        if (StatusCodes.NS_PUBLISH_START.equals(code)) {

            startPublish = true;
            //this.onStartStream();
        }
    }

    public void resultReceived(IPendingServiceCall call) {



        if ("connect".equals(call.getServiceMethodName())) {
            createStream(this);

        } else if ("createStream".equals(call.getServiceMethodName())) {

            
                publishStreamId = (Integer) call.getResult();
                System.out.println("createPublishStream result stream id: " + publishStreamId);
                System.out.println("publishing video by name: " + publishName);
                publish(publishStreamId, publishName, "live", (INetStreamEventHandler) this);

        }
    }   
    
}
/**
*the usage:
*/
     final ClienteRTMP client = new ClienteRTMP();
            client.startStream(host, app, port, "test", "Paulo", "123");
            client.addEventlistener(new ClienteRTMP.IStreamEvent() {
                private MP4Service service;
                public void onStreamStart() {
                   new Thread(new Runnable() {

                        public void run() {
                            service = new MP4Service();
                            service.setSerializer(new Serializer());
                            service.setDeserializer(new Deserializer());
                            IRTMPEvent event = null;
                            // Read In File And Publish The Data !!
                            try {

                                File f = new File("d:\\test70.mp4");
                                IMP4 mp4 = (IMP4) service.getStreamableFile(f);
                                ITagReader reader = mp4.getReader();
                                FileStreamSource src = new FileStreamSource(reader);
                                int first = -1;
                                while (src.hasMore()) {
                                    event = src.dequeue();
                                    RTMPMessage rtmpMsg = new RTMPMessage();
                                    rtmpMsg.setBody(event);
                                   client.publishStreamData(client.publishStreamId, rtmpMsg);
                                }
                                client.unpublish(client.publishStreamId);
                            } catch (Exception ex) {
                                System.out.println(ex.getCause().toString());
                            }
                        }
                    }).start();
                }
            });

   

From: phmasters at hotmail.com
To: red5 at osflash.org
Date: Thu, 3 Sep 2009 19:24:01 +0000
Subject: Re: [Red5] H.264 Flash dont Play - Debug Player?








More news, hehe 
It
seems that everything works through VOD, but when I put the video
through RTMPClient.publishStreamData (), reading the mp4 file through
MP4Reader class, only the video with 70 frames or more works.
the code that I used in RTMPClient to read the file is:

new Thread(new Runnable() {

                        public void run() {
                            service = new MP4Service();
                            service.setSerializer(new Serializer());
                            service.setDeserializer(new Deserializer());
                            IRTMPEvent event = null;
                            // Read In File And Publish The Data !!
                            try {

                                File f = new File("d:\\test70.mp4");
                              
                                IMP4 mp4 = (IMP4) service.getStreamableFile(f);
                                ITagReader reader = mp4.getReader();
                                FileStreamSource src = new FileStreamSource(reader);
                                int first = -1;
                                while (src.hasMore()) {
                                    event = src.dequeue();
                                    RTMPMessage rtmpMsg = new RTMPMessage();
                                    rtmpMsg.setBody(event);
                                    client.publishStreamData(client.publishStreamId, rtmpMsg);
                                }
                                client.unpublish(client.publishStreamId);
                            } catch (Exception ex) {
                                System.out.println(ex.getCause().toString());
                            }
                        }
                    }).start();

this code is executed only when the client receive a NS_PUBLISH_START status code in the onInvoke method from RTMPClient
From: phmasters at hotmail.com
To: red5 at osflash.org
Date: Thu, 3 Sep 2009 19:11:59 +0000
Subject: Re: [Red5] H.264 Flash dont Play - Debug Player?








Hey jake, did you play through VOD?

From: roger at RogerPf.com
To: red5 at osflash.org
Date: Thu, 3 Sep 2009 19:55:58 +0100
Subject: Re: [Red5] H.264 Flash dont Play - Debug Player?










For what is it worth - I have noticed that the debug version of flash 
player 10 is more robust at playing (& recording?) short videos.  
I have not used eariler versions enough to be sure if this was also 
true of them.  
 
Of course you may find differently. :)
 
--
Roger
 
 

  ----- Original Message ----- 
  From: 
  Jake Hilton 
  
  To: red5 at osflash.org 
  Sent: Thursday, 03 September, 2009 7:41 
  PM
  Subject: Re: [Red5] H.264 Flash dont 
  Play
  
They both play for me.
  

  Jake


  2009/9/3 Paulo henrique França Silva <phmasters at hotmail.com>

  
    
    Hello guys, I have news. 
It seems that videos with less 
    than 70 frames do not play on the Adobe flash. 
Follow the links to the 
    videos used. One of 60 frames, does not play, and another of 70, this plays. 
    

http://www.4shared.com/file/129953752/7f4f0447/test60.html 
    

http://www.4shared.com/file/129953173/3ef32ae1/test70.html


    
    Date: Thu, 3 Sep 2009 14:07:55 -0300
From: tiago at imdt.com.br
To: 
    red5 at osflash.org
    
Subject: Re: [Red5] H.264 Flash dont Play


    
    
    Please publish somewhere on WEB the video in question, so we 
    can what goes wrong.
Tiago

Paulo henrique França Silva wrote: 
    Hello Walter 
I think the problem is not the bitrate, since 
      the video in question has a low bitrate. 
It seems that the problem 
      lies in the entropy encoding performed in ffmpeg. I changed all the 
      possible properties of the stream xuggle, but nothing worked.
Another 
      thing I couldn't do was specify the profile and level through 
      xuggle



    
    Navegue com segurança com o Novo Internet Explorer 8. Baixe agora, é 
    gratis!
_______________________________________________
Red5 
    mailing list
Red5 at osflash.org
http://osflash.org/mailman/listinfo/red5_osflash.org



  
  


  
_______________________________________________
Red5 mailing 
  list
Red5 at osflash.org
http://osflash.org/mailman/listinfo/red5_osflash.org

Novo Internet Explorer 8: traduza com apenas um clique.  Baixe agora, é grátis!
Com o Novo Internet Explorer 8 suas abas se organizam por cor. Baixe agora, é grátis!
Novo Internet Explorer 8: traduza com apenas um clique.  Baixe agora, é grátis!
_________________________________________________________________
Você sabia que pode acessar o Messenger direto do seu Hotmail? Descubra como!
http://www.microsoft.com/brasil/windows/windowslive/products/tutoriais.aspx
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://osflash.org/pipermail/red5_osflash.org/attachments/20090903/3eb455c6/attachment-0001.html>


More information about the Red5 mailing list