用ffmpeg转码和片段 [英] transcode and segment with ffmpeg

查看:255
本文介绍了用ffmpeg转码和片段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

看起来ffmpeg现在有一个分隔符,或至少有一个命令行选项

It appears that ffmpeg now has a segmenter in it, or at least there is a command line option

-f段

在文档中。

这是否意味着我可以使用ffmpeg将视频实时转码为h.264,并使用ffmpeg单独提供分段的IOS兼容的.m3u8流?如果是这样,什么命令将任意视频文件转码为分段的h.264 aac 640 x 480流ios兼容流?

Does this mean I can use ffmpeg to realtime-transcode a video into h.264 and deliver segmented IOS compatible .m3u8 streams using ffmpeg alone? if so, what would a command to transcode an arbitrary video file to a segmented h.264 aac 640 x 480 stream ios compatible stream?

推荐答案

绝对 - 您可以使用 -f段将视频片段分片,并将其投放到iOS设备。 ffmpeg将创建段文件,并且可以为任何Web服务器提供服务。

Absolutely - you can use -f segment to chop video into pieces and serve it to iOS devices. ffmpeg will create segment files .ts and you can serve those with any web server.

工作示例(禁用声音) - ffmpeg version N -39494-g41a097a:

Working example (with disabled sound) - ffmpeg version N-39494-g41a097a:

./ffmpeg -v 9 -loglevel 99 -re -i sourcefile.avi -an \
-c:v libx264 -b:v 128k -vpre ipod320 \ 
-flags -global_header -map 0 -f segment -segment_time 4 \
-segment_list test.m3u8 -segment_format mpegts stream%05d.ts

提示:


  • 确保您从最近的存储库

  • 使用libx264编解码器编译

  • -map 0需要

  • make sure you compile ffmpeg from most recent git repository
  • compile with libx264 codec
  • -map 0 is needed

我如何编译FFMPEG - 通过额外的rtmp支持从 flash-media-server

How I compiled FFMPEG - with extra rtmp support to get feeds from flash-media-server

export PKG_CONFIG_PATH="/usr/lib/pkgconfig/:../rtmpdump-2.3/librtmp"    

./configure --enable-librtmp --enable-libx264 \
--libdir='../x264/:/usr/local/lib:../rtmpdump-2.3' \
--enable-gpl --enable-pthreads --enable-libvpx \
--disable-ffplay --disable-ffserver --disable-shared --enable-debug

这篇关于用ffmpeg转码和片段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆