关于Http Live Streaming 的一点儿记录

此文合并到本人的文章 如何用nginx+ffmpeg实现苹果HLS协议

http://blog.csdn.net/deltatang/article/details/7931827

------------------------------------------------------------------------------------------------------------------------------------------------------


http://developer.android.com/guide/appendix/media-formats.html

andorid 的支持。



以下的内容是最初开始的资料,基本没有啥子价值,可以略过了:)

---------------------------------------------------

HLS协议文档

HTTP Live Streamingdraft-pantos-http-live-streaming

http://tools.ietf.org/html/draft-pantos-http-live-streaming-00


hls 是apple 开发的,主要是解决ios 视频播放问题。将文件切成很多小片来播放,为了 可以动态切换码流,并且播放不会占用很多资源。

切片属于内存的索引文件映射,实际物理视频文件是完整的一个。

多码率可以理解为索引文件对特定时间点的多个码率文件access位置的记录。


ios对单次下载的视频文件最大大小进行了限制,如果单个mp4文件大小超出,可能面临无法播放的问题。所以必须走hls才能保证正常播放。


adobe 为了和hls 对抗 所以才有了 hds,并且有了fmp4 这种文件格式。


有两个工作:
1. a tool —— 生成索引
2. b tool —— 提供http的服务


一个开源项目

http://smoothstreaming.code-shop.com/trac

下载的有:

SET ver=1.4.24
wget http://smoothstreaming.code-shop.com/download/apache_mod_smooth_streaming-%ver%.tar.gz
wget http://smoothstreaming.code-shop.com/download/nginx_mod_smooth_streaming-%ver%.tar.gz
wget http://smoothstreaming.code-shop.com/download/ffmpeg_ism-%ver%.tar.gz
wget http://smoothstreaming.code-shop.com/download/mp4split-%ver%.tar.gz

adobe 官方的dev media server 有链接数限制


http://sourceforge.net/apps/mediawiki/osmf.adobe/index.php?title=Customizing_HTTP_Dynamic_Streaming

http://sourceforge.net/apps/mediawiki/osmf.adobe/index.php?title=Dynamic_Streaming

http://sourceforge.net/apps/mediawiki/osmf.adobe/index.php?title=Flash_Media_Manifest_%28F4M%29_File_Format

http://osmf.org

http://sourceforge.net/apps/mediawiki/osmf.adobe/index.php?title=Main_Page


Converting H.264 MPEG4 to TS with ffmpeg

http://www.shortword.net/blog/2009/12/18/converting-h-264-mpeg4-to-ts-with-ffmpeg/

Where in the mp4 file structure is the duration of it?

http://stackoverflow.com/questions/3057157/anyone-familiar-with-mp4-data-structure

FFMPEG API

http://ffmpeg.org/documentation.html

http://wiki.aasimon.org/doku.php?id=ffmpeg:ffmpeg#ffmpeg_api_documentation


An ffmpeg and SDL Tutorial

or

How to Write a Video Player in Less Than 1000 Lines


http://dranger.com/ffmpeg/


http://stackoverflow.com/search?page=2&tab=relevance&q=libavformat%20split%20mp4

http://stackoverflow.com/questions/3663797/mp4-container-writer-in-java

HLS vs. HDS – What Is the Difference and Why You Should Care

http://www.overdigital.com/2011/12/27/hls-vs-hds-what-is-the-difference-and-why-you-should-care/


How to seek in FFmpeg C/C++

http://stackoverflow.com/questions/5261658/how-to-seek-in-ffmpeg-c-c

bool seekMs(int tsms)
{
   //printf("**** SEEK TO ms %d. LLT: %d. LT: %d. LLF: %d. LF: %d. LastFrameOk: %d\n",tsms,LastLastFrameTime,LastFrameTime,LastLastFrameNumber,LastFrameNumber,(int)LastFrameOk);

   // Convert time into frame number
   DesiredFrameNumber = ffmpeg::av_rescale(tsms,pFormatCtx->streams[videoStream]->time_base.den,pFormatCtx->streams[videoStream]->time_base.num);
   DesiredFrameNumber/=1000;

   return seekFrame(DesiredFrameNumber);
}

bool seekFrame(ffmpeg::int64_t frame)
{

   //printf("**** seekFrame to %d. LLT: %d. LT: %d. LLF: %d. LF: %d. LastFrameOk: %d\n",(int)frame,LastLastFrameTime,LastFrameTime,LastLastFrameNumber,LastFrameNumber,(int)LastFrameOk);

   // Seek if:
   // - we don't know where we are (Ok=false)
   // - we know where we are but:
   //    - the desired frame is after the last decoded frame (this could be optimized: if the distance is small, calling decodeSeekFrame may be faster than seeking from the last key frame)
   //    - the desired frame is smaller or equal than the previous to the last decoded frame. Equal because if frame==LastLastFrameNumber we don't want the LastFrame, but the one before->we need to seek there
   if( (LastFrameOk==false) || ((LastFrameOk==true) && (frame<=LastLastFrameNumber || frame>LastFrameNumber) ) )
   {
      //printf("\t avformat_seek_file\n");
      if(ffmpeg::avformat_seek_file(pFormatCtx,videoStream,0,frame,frame,AVSEEK_FLAG_FRAME)<0)
         return false;

      avcodec_flush_buffers(pCodecCtx);

      DesiredFrameNumber = frame;
      LastFrameOk=false;
   }
   //printf("\t decodeSeekFrame\n");

   return decodeSeekFrame(frame);

   return true;
}


html content type for HLS:

//mimetype.assign = ( ".m3u8" => "application/x-mpegURL", ".ts" => "video/MP2T" )
@see

http://stackoverflow.com/questions/3209243/iphone-http-streaming-m3u8-and-ts-files-how-to-create-using-ffmpeg


切分音频的帖子

http://ffmpeg.arrozcru.org/forum/viewtopic.php?f=8&t=1259

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 6
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值