4 Replies Latest reply on Sep 8, 2010 2:21 PM by everythingelsewastakentoo

    byte range request -- need help understanding how to parse flv tag in middle of video

    everythingelsewastakentoo Level 1

      I am trying to implement range request streaming so that I can play my videos from amazon s3 and still have adaptive quality.

       

      I am to the point where I can play the video using byte range requests as long as I start from the first keyframe.  The next step is to be able to create the correct flv tags to allow me to randomly seek.

       

      I am having trouble understanding the code from the HTTPNetStream.as that handles the appendbytes process and generates the flv tags to append.  Can anyone point me towards any resources or a tutorial maybe that would help me understand how to create flv tags on the fly?  I am guessing that I just need to modify the timestamp accordingly, but the HTTPNetStream is complex and I am having problems understanding it from just reading the code.

       

      Thanks.

        • 1. Re: byte range request -- need help understanding how to parse flv tag in middle of video
          weizhangstrobe Level 2

          Hi,

           

          Would you please provide more details such that I can better assist you? Are you doing http dynamic streaming? Do you use Zeri to package your content?

           

           

          -Wei Zhang

          Senior Computer Scientist

          Adobe Systems, Inc.

          weizhang@adobe.com

          • 2. Re: byte range request -- need help understanding how to parse flv tag in middle of video
            everythingelsewastakentoo Level 1

            I am not using zeri to prepackage my content.  I am encoding my content so that my video has several bitrates available with aligned keyframes.  The end goal is to be able to adaptively swap between the bitrates as the network conditions change on the client side using netstream appendbytes, but I am just trying to be able to randomly seek in one video file at this time.

             

            I have access to the video keyframes metadata before the video is downloaded.  This gives me access to the video keyframes time and byte position.  I am using byte range requests to download the video in chunks and using the appendbytes method on the netstream to display the video.

             

            So basically I have information like this:

            _keyframes = {                 "filepositions": [                     1063,                     20027,                     174923,                     424338,                     471580,                     558106,                     710258,                     817498,                     923494,                     1071083,                     1219012,                     1347053,                     1433075,                     1500748,                     1554354,                     1640752,                     1709317,                     1917781,                     2026482,                     2138675,                     2187530,                     2282596,                     2525144                 ],                 "times": [                     0.0,                     1.33,                     3.34,                     7.26,                     8.26,                     9.55,                     12.64,                     14.35,                     16.43,                     18.56,                     20.48,                     22.11,                     23.65,                     24.61,                     25.57,                     26.73,                     27.82,                     30.86,                     32.66,                     34.83,                     35.83,                     37.29,                     40.0                 ]             };

             

            This works for me as long as I start at time 0, but when I start at any time after time zero when seeking (say
            26.73) by requesting the download to start the byte offset that goes with the time, I cannot get the video to play.  I think this is because I am not passing a proper flv tag to the append bytes function.

             

            I have to serve my files off of s3 so I do not have the option to use the zeri apache server module to make all of this automatic.

             

            I am using a customized NetStream and NetLoader to try to incorporate this into an OSMF player.  I found a similar post on the forums but there was not a lot of detail given: http://forums.adobe.com/message/3066869#3066869

             

             

            Thanks

            • 3. Re: byte range request -- need help understanding how to parse flv tag in middle of video
              weizhangstrobe Level 2

              I consulted our audio/video expert and here is what he speculates.

               

              In order to play audio and video, you need to feed AVCC packet for video and AAC packet for audio before feed any other bytes to the Flash Player. When you start from key frame 0, the first two packets could be AVCC and AAC. Therefore it works. But when you start from the middle, AVCC and AAC are absent and so it will not play.

               

               

               

              -Wei Zhang

              Senior Computer Scientist

              Adobe Systems, Inc.

              weizhang@adobe.com

              • 4. Re: byte range request -- need help understanding how to parse flv tag in middle of video
                everythingelsewastakentoo Level 1

                Is it feasible to generate an AVCC packet directly in a byte array and then pass the file header plus the "faked" packet through the appendBytes method?  Would this then satisfy the byte parser requirements of starting with the avcc packet and allow feeding a random portion of the flv file after passing a reset seek to the appendBytesAction method?