[转]Iphone m3u8 segmenter from ffmpeg for video streaming
源地址:http://lukasz.cepowski.com/devlog/30,iphone-m3u8-segmenter-from-ffmpeg-for-video-streaming
Recent versions of ffmpeg contains a m3u8 segmenter feature which can be used for remuxing video files for streaming over http and watching video on iphone.
Segmenter feature usage for iphone
Let's say that there is some .ts media file encoded with mpegts codec and we want to segment it for streaming over http. Segmenting is a process where one media container is being converted into set of smaller files with different quality to adjust the current quality to the bandwidth between streaming server and the display, iphone in this case. Segmenter will produce a set of smaller .ts files and a "playlist" .m3u8 which contains urls of the .ts files.
To process media by ffmpeg builtin segmenter run:
ffmpeg -re -i source.ts -codec copy -map 0 -f segment -segment_list foo.m3u8 -segment_list_flags +live -segment_time 10 out%03d.ts
It will produce .m3u8 playlist and .ts files with segments.
Note that this command will not transcode the video, it will just split data. Source .ts file should be encoded with mpegts codec in order to play it on iphone.
Compile static version of ffmpeg
Following steps are required to build stable static version of ffmpeg-1.0. Tested on debian i386 and amd64.
Based on https://github.com/stvs/ffmpeg-static
Install compiler and essential packages
apt-get -y install build-essential pkg-config bzip2
Create build and target directories
BUILD_DIR="/home/user/build"; export BUILD_DIR
TARGET_DIR="/home/user/target"; export TARGET_DIR
mkdir -p $BUILD_DIR
mkdir -p $TARGET_DIR
yasm
cd $BUILD_DIR
wget "http://mirror.hellworx.com/yasm/yasm-1.2.0.tar.gz"
tar zxvf yasm-1.2.0.tar.gz
cd yasm-1.2.0
./configure --prefix=$TARGET_DIR
make -j 4
make install
zlib
cd $BUILD_DIR
wget "http://mirror.hellworx.com/zlib/zlib-1.2.7.tar.bz2"
tar jxvf zlib-1.2.7.tar.bz2
cd zlib-1.2.7
./configure --prefix=$TARGET_DIR
make -j 4
make install
bzip2
cd $BUILD_DIR
wget "http://mirror.hellworx.com/bzip2/bzip2-1.0.6.tar.gz"
tar zxvf bzip2-1.0.6.tar.gz
cd bzip2-1.0.6
make
make install PREFIX=$TARGET_DIR
libpng
cd $BUILD_DIR
wget "http://mirror.hellworx.com/libpng/libpng-1.2.50.tar.gz"
tar zxvf libpng-1.2.50.tar.gz
cd libpng-1.2.50
CFLAGS="-I$TARGET_DIR/include" LDFLAGS="-L$TARGET_DIR/lib -lm" ./configure --prefix=$TARGET_DIR --enable-static --disable-shared
make -j 4
make install
make -j 4
make install
libogg
cd $BUILD_DIR
wget "http://mirror.hellworx.com/libogg/libogg-1.3.0.tar.gz"
tar zxvf libogg-1.3.0.tar.gz
cd libogg-1.3.0
CFLAGS="-I$TARGET_DIR/include" LDFLAGS="-L$TARGET_DIR/lib -lm" ./configure --prefix=$TARGET_DIR --enable-static --disable-shared
make -j 4
make install
libvorbis
cd $BUILD_DIR
wget "http://mirror.hellworx.com/libvorbis/libvorbis-1.3.3.tar.gz"
tar zxvf libvorbis-1.3.3.tar.gz
cd libvorbis-1.3.3
CFLAGS="-I$TARGET_DIR/include" LDFLAGS="-L$TARGET_DIR/lib -lm" ./configure --prefix=$TARGET_DIR --enable-static --disable-shared
make -j 4
make install
libtheora
cd $BUILD_DIR
wget "http://mirror.hellworx.com/libtheora/libtheora-1.1.1.tar.bz2"
tar jxvf libtheora-1.1.1.tar.bz2
cd libtheora-1.1.1
CFLAGS="-I$TARGET_DIR/include" LDFLAGS="-L$TARGET_DIR/lib -lm" ./configure --prefix=$TARGET_DIR --enable-static --disable-shared
make -j 4
make install
libvpx
cd $BUILD_DIR
wget "http://mirror.hellworx.com/libvpx/libvpx-v1.0.0.tar.bz2"
tar jxvf libvpx-v1.0.0.tar.bz2
cd libvpx-v1.0.0
PATH="$TARGET_DIR/bin:$PATH" CFLAGS="-I$TARGET_DIR/include" LDFLAGS="-L$TARGET_DIR/lib -lm" ./configure --prefix=$TARGET_DIR --enable-static --disable-shared
PATH="$TARGET_DIR/bin:$PATH" make -j 4
PATH="$TARGET_DIR/bin:$PATH" make install
faac
cd $BUILD_DIR
wget "http://mirror.hellworx.com/faac/faac-1.28.tar.bz2"
tar jxvf faac-1.28.tar.bz2
cd faac-1.28
CFLAGS="-I$TARGET_DIR/include" LDFLAGS="-L$TARGET_DIR/lib -lm" ./configure --prefix=$TARGET_DIR --enable-static --disable-shared
sed -i -e "s|^char \*strcasestr.*|//\0|" common/mp4v2/mpeg4ip.h
make -j 4
make install
x264
cd $BUILD_DIR
wget "http://mirror.hellworx.com/x264/x264-snapshot-20120425-2245.tar.bz2"
tar jxvf x264-snapshot-20120425-2245.tar.bz2
cd x264-snapshot-20120425-2245
PATH="$TARGET_DIR/bin:$PATH" CFLAGS="-I$TARGET_DIR/include" LDFLAGS="-L$TARGET_DIR/lib -lm" ./configure --prefix=$TARGET_DIR --enable-static
PATH="$TARGET_DIR/bin:$PATH" make -j 4
PATH="$TARGET_DIR/bin:$PATH" make install
xvidcore
cd $BUILD_DIR
wget "http://mirror.hellworx.com/xvidcore/xvidcore-1.3.2.tar.gz"
tar zxvf xvidcore-1.3.2.tar.gz
cd xvidcore/build/generic
CFLAGS="-I$TARGET_DIR/include" LDFLAGS="-L$TARGET_DIR/lib -lm" ./configure --prefix=$TARGET_DIR --enable-static --disable-shared
make -j 4
make install
lame
cd $BUILD_DIR
wget "http://mirror.hellworx.com/lame/lame-3.99.5.tar.gz"
tar zxvf lame-3.99.5.tar.gz
cd lame-3.99.5
CFLAGS="-I$TARGET_DIR/include" LDFLAGS="-L$TARGET_DIR/lib -lm" ./configure --prefix=$TARGET_DIR --enable-static --disable-shared
make -j 4
make install
remove shared objects
cd $TARGET_DIR/lib
rm -f *.dylib*
rm -f *.so*
ffmpeg
cd $BUILD_DIR
wget "http://mirror.hellworx.com/ffmpeg/ffmpeg-1.0.tar.gz"
tar zxvf ffmpeg-1.0.tar.gz
cd ffmpeg-1.0
PATH="$TARGET_DIR/bin:$PATH" CFLAGS="-I$TARGET_DIR/include" LDFLAGS="-L$TARGET_DIR/lib -lm" ./configure --prefix=$TARGET_DIR --extra-version=static --disable-debug --disable-shared --enable-static --extra-cflags=--static --disable-ffplay --disable-ffserver --disable-doc --enable-gpl --enable-pthreads --enable-postproc --enable-gray --enable-runtime-cpudetect --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-bzlib --enable-zlib --enable-nonfree --enable-version3 --enable-libvpx --disable-devices
PATH="$TARGET_DIR/bin:$PATH" make -j 4
PATH="$TARGET_DIR/bin:$PATH" make install
Download static ffmpeg
You can download static builds of ffmpeg from here:
debian6-i386: http://mirror.hellworx.com/ffmpeg/ffmpeg-static/i386/ffmpeg.bin
debian6-amd64: http://mirror.hellworx.com/ffmpeg/ffmpeg-static/amd64/ffmpeg.bin
[转]Iphone m3u8 segmenter from ffmpeg for video streaming的更多相关文章
- 使用OpenCV和imagezmq通过网络实时传输视频流 | live video streaming over network with opencv and imagezmq
本文首发于个人博客https://kezunlin.me/post/b8847d9f/,欢迎阅读最新内容! live video streaming over network with opencv ...
- ffmpeg+nginx+video实现rtsp流转hls流,通过H5查看监控视频
一.FFmpeg下载:http://ffmpeg.zeranoe.com/builds/ 下载并解压FFmpeg文件夹,配置环境变量:在“Path”变量原有变量值内容上加上d:\ffmpeg\bin, ...
- MRPT笔记——MRPT在VS2013中的配置
Mobile Robot Programming Toolkit (MRPT)是一个跨平台的.开源的C++库,旨在帮助机器人研究员设计和实现SLAM.机器视觉和运动规划(避障)的算法. MRPT为移动 ...
- ffmpeg 频中分离 video audio 截取片断
1.获取视频的信息 ffmpeg -i video.avi 2,将图片序列分解合成视频 ffmpeg -i src.mpg image%d.jpg ffmpeg -f image2 -i ...
- ffmpeg把ts文件转m3u8并切片
Linux_x86_64流媒体环境:nginx + EasyDarwin-master 客户端播放器:VLC media player 下载windows下的ffmepg二进制版本,请进网站http: ...
- ffmpeg下载m3u8流媒体
安装 编译好的windows可用版本的下载地址(官网中可以连接到这个网站,和官方网站保持同步): http://ffmpeg.zeranoe.com/builds/ 该版本为FFMPEG的Static ...
- Linux 下使用 ffmpeg 大批量合并 ts 文件, mp4切割文件为m3u8
见范例 ffmpeg -i "concat:file001.ts|file002.ts|file003.ts|file004.ts......n.ts" -acodec copy ...
- ffmpeg m3u8生成 剪辑及格式转换
使用 ffmpeg 工具, 生成 m3u8 文件 ffmpeg -re -i 03.ts -c copy -f hls -hls_base_url /Users/admin/Downloads/dow ...
- 网页前端video播放m3u8(HLS)
网页前端video播放m3u8(HLS) HLS (HTTP Live Streaming)是Apple公司研发的流媒体传输技术,包括一个m3u8的索引文件.多个ts分片文件和key加密串文件.这项技 ...
随机推荐
- smb_精简安装
yum install samba vim /etc/samba/smb.conf [修改下自己要发布的目录 .eg : path = /home/iknow] smbpasswd -a ik ...
- 关闭safari浏览器button默认样式
前两天又遇到一个头疼的问题,在Chrome上调试好的样式,去到手机上打开,傻了... 这是什么鬼... 搜了一下,才知道这是appearance属性搞的鬼.. . 比方你想让一个div拥有button ...
- 从头开始学JavaScript (七)——函数
原文:从头开始学JavaScript (七)--函数 一.return 函数在执行完return之后停止并立即退出. return返回值:与return: 如下两个例子: function sum(n ...
- ASP.NET——RequiredFieldValidator控制和ValidationSummary控制
我们的登录页面,忘记承担损失password然后username,该页面将永远是一个小提醒. 那么我们在网也制作的时候怎样实现这一功能呢?这就用到了RequiredFieldValidator控件和V ...
- HDU 4793 2013 Changsha Regional Collision[简单的平面几何]
圆形奖章给定半径的半径和圆形区域.另一个硬币的半径,然后在桌面上平稳.给定硬币的速(的大小和方向,vx,vy)和坐标(奖牌同心圆形区域,圆和心脏为源),Q币在一个圆形区域和多少下滑(不管是什么圆形区域 ...
- JqueryAjax异步加载在ASP.NET
前台代码 <script src="Scripts/jquery-1.4.1.min.js" type="text/javascript">< ...
- Go as continuous delivery tool for .NET
http://simon-says-architecture.com/2014/02/28/go-as-continuous-delivery-tool-for-net/ Following my p ...
- C++并发编程学习笔记<1> 入门
入门 多线程C++程序是什么样子的? 它看上去和其它全部C++程序一样,一般是变量.类以及函数的组合. 唯一真正的差别在于某些函数能够并发执行, 当然.为了并发地执行函数,必须使用特定的函数以及对象来 ...
- 基于4.5Framework web程序、SQLSERVER数据库打包
原文:基于4.5Framework web程序.SQLSERVER数据库打包 估计很多朋友和我一样,对于C/S程序打包很熟悉,但对于B/S程序打包一头雾水... 最近公司要求我们把项目和数据库(SQL ...
- swift 笔记 (二十) —— 泛型
泛型 泛型是为了解决在针对不同数据类型.而做了同一种功能的操作导致的每一个类型我们都要写一份代码的问题. 有了泛型,我们能够仅仅写一份逻辑代码,而适应于不同的数据类型. func swapInt(in ...