使用 ffmpeg 进行转码和分段 [英] transcode and segment with ffmpeg

查看:34
本文介绍了使用 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 segment 将视频切碎并提供给 iOS 设备.ffmpeg 将创建段文件 .ts,您可以使用任何 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 版本 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 编解码器编译
  • -需要映射 0

我如何编译 FFMPEG - 使用额外的 rtmp 支持从

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天全站免登陆