1
cd /usr/local/nginx/html/broadcast3
2,
ffmpeg -i 20150428101917_31520150408监利新闻(三).flv -c:v libx264 -c:a aac -strict -2 -f hls test22.m3u8
执行结果:
ffmpeg version N-72743-g130a6c0 Copyright (c) 2000-2015 the FFmpeg developers built with gcc 4.8.3 (GCC) 20140911 (Red Hat 4.8.3-9) configuration: --enable-version3 --enable-libvpx --enable-libfaac --enable-libmp3lame --enable-libvorbis --enable-libx264 --enable-libxvid --enable-shared --enable-gpl --enable-postproc --enable-nonfree --enable-avfilter --enable-pthreads --enable-libnut --enable-libtheora libavutil 54. 27.100 / 54. 27.100 libavcodec 56. 41.100 / 56. 41.100 libavformat 56. 36.100 / 56. 36.100 libavdevice 56. 4.100 / 56. 4.100 libavfilter 5. 16.101 / 5. 16.101 libswscale 3. 1.101 / 3. 1.101 libswresample 1. 2.100 / 1. 2.100 libpostproc 53. 3.100 / 53. 3.100 Input #0, flv, from '20150428101917_31520150408监利新闻(三).flv': Metadata: encoder : Lavf53.6.0 Duration: 00:23:02.61, start: 0.000000, bitrate: 453 kb/s Stream #0:0: Video: flv1, yuv420p, 320x240, 800 kb/s, 18 fps, 18 tbr, 1k tbn, 1k tbc Stream #0:1: Audio: mp3, 22050 Hz, stereo, s16p, 58 kb/s [libx264 @ 0xfa8680] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 [libx264 @ 0xfa8680] profile High, level 1.2 Output #0, hls, to 'test22.m3u8': Metadata: encoder : Lavf56.36.100 Stream #0:0: Video: h264 (libx264), yuv420p, 320x240, q=-1--1, 18 fps, 90k tbn, 18 tbc Metadata: encoder : Lavc56.41.100 libx264 Stream #0:1: Audio: aac, 22050 Hz, stereo, fltp, 128 kb/s Metadata: encoder : Lavc56.41.100 aac Stream mapping: Stream #0:0 -> #0:0 (flv1 (flv) -> h264 (libx264)) Stream #0:1 -> #0:1 (mp3 (native) -> aac (native)) Press [q] to stop, [?] for help frame=24886 fps=131 q=27.0 Lsize=N/A time=00:23:02.60 bitrate=N/A video:40726kB audio:21245kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown [libx264 @ 0xfa8680] frame I:180 Avg QP:18.64 size: 13909 [libx264 @ 0xfa8680] frame P:18092 Avg QP:23.20 size: 2073 [libx264 @ 0xfa8680] frame B:6614 Avg QP:26.06 size: 257 [libx264 @ 0xfa8680] consecutive B-frames: 60.2% 10.6% 7.8% 21.4% [libx264 @ 0xfa8680] mb I I16..4: 13.8% 66.2% 20.0% [libx264 @ 0xfa8680] mb P I16..4: 0.6% 1.9% 0.3% P16..4: 25.3% 14.2% 12.6% 0.0% 0.0% skip:45.1% [libx264 @ 0xfa8680] mb B I16..4: 0.1% 0.3% 0.0% B16..8: 21.6% 2.9% 0.9% direct: 1.0% skip:73.3% L0:41.6% L1:45.6% BI:12.8% [libx264 @ 0xfa8680] 8x8 transform intra:67.8% inter:67.4% [libx264 @ 0xfa8680] coded y,uvDC,uvAC intra: 69.6% 73.8% 34.0% inter: 20.4% 13.7% 2.9% [libx264 @ 0xfa8680] i16 v,h,dc,p: 13% 69% 12% 6% [libx264 @ 0xfa8680] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 16% 28% 28% 4% 4% 4% 6% 4% 7% [libx264 @ 0xfa8680] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 20% 31% 13% 5% 6% 6% 7% 5% 7% [libx264 @ 0xfa8680] i8c dc,h,v,p: 43% 34% 18% 5% [libx264 @ 0xfa8680] Weighted P-Frames: Y:0.9% UV:0.5% [libx264 @ 0xfa8680] ref P L0: 73.5% 15.3% 7.8% 3.4% 0.0% [libx264 @ 0xfa8680] ref B L0: 86.6% 11.0% 2.4% [libx264 @ 0xfa8680] ref B L1: 94.9% 5.1% [libx264 @ 0xfa8680] kb/s:241.31
但是m3u8 文件中的切片不全
vim test22.m3u8
#EXTM3U #EXT-X-VERSION:3 #EXT-X-TARGETDURATION:11 #EXT-X-MEDIA-SEQUENCE:168 #EXTINF:3.111111, test22168.ts #EXTINF:3.666667, test22169.ts #EXTINF:10.111111, test22170.ts #EXTINF:10.000000, test22171.ts #EXTINF:4.888889, test22172.ts #EXT-X-ENDLIST
参考:
http://www.cnblogs.com/littlehb/p/3914437.html
http://hdu104.com/294
http://blog.csdn.net/liuhongxiangm/article/details/18666993
http://blog.csdn.net/cdnight/article/details/39156711