FFmpeg m3u8和ts源 按ts截图

&>&ffmpeg文件生成m3u8文件及ts切片程序_1
ffmpeg文件生成m3u8文件及ts切片程序_1
上传大小:46.24MB
ffmpeg文件生成m3u8文件及ts切片程序_1,实现输入本地文件切片成ts文件,m3u8,demo级别
综合评分:3
下载个数:
{%username%}回复{%com_username%}{%time%}\
/*点击出现回复框*/
$(".respond_btn").on("click", function (e) {
$(this).parents(".rightLi").children(".respond_box").show();
e.stopPropagation();
$(".cancel_res").on("click", function (e) {
$(this).parents(".res_b").siblings(".res_area").val("");
$(this).parents(".respond_box").hide();
e.stopPropagation();
/*删除评论*/
$(".del_comment_c").on("click", function (e) {
var id = $(e.target).attr("id");
$.getJSON('/index.php/comment/do_invalid/' + id,
function (data) {
if (data.succ == 1) {
$(e.target).parents(".conLi").remove();
alert(data.msg);
$(".res_btn").click(function (e) {
var parentWrap = $(this).parents(".respond_box"),
q = parentWrap.find(".form1").serializeArray(),
resStr = $.trim(parentWrap.find(".res_area_r").val());
console.log(q);
//var res_area_r = $.trim($(".res_area_r").val());
if (resStr == '') {
$(".res_text").css({color: "red"});
$.post("/index.php/comment/do_comment_reply/", q,
function (data) {
if (data.succ == 1) {
var $target,
evt = e || window.
$target = $(evt.target || evt.srcElement);
var $dd = $target.parents('dd');
var $wrapReply = $dd.find('.respond_box');
console.log($wrapReply);
//var mess = $(".res_area_r").val();
var mess = resS
var str = str.replace(/{%header%}/g, data.header)
.replace(/{%href%}/g, 'http://' + window.location.host + '/user/' + data.username)
.replace(/{%username%}/g, data.username)
.replace(/{%com_username%}/g, data.com_username)
.replace(/{%time%}/g, data.time)
.replace(/{%id%}/g, data.id)
.replace(/{%mess%}/g, mess);
$dd.after(str);
$(".respond_box").hide();
$(".res_area_r").val("");
$(".res_area").val("");
$wrapReply.hide();
alert(data.msg);
}, "json");
/*删除回复*/
$(".rightLi").on("click", '.del_comment_r', function (e) {
var id = $(e.target).attr("id");
$.getJSON('/index.php/comment/do_comment_del/' + id,
function (data) {
if (data.succ == 1) {
$(e.target).parent().parent().parent().parent().parent().remove();
$(e.target).parents('.res_list').remove()
alert(data.msg);
//填充回复
function KeyP(v) {
var parentWrap = $(v).parents(".respond_box");
parentWrap.find(".res_area_r").val($.trim(parentWrap.find(".res_area").val()));
评论共有18条
弄不明白研究研究
程序下载就能用,基于这个开发就行,正在修改成多线程,实现多路视频切片
不错,再研究研究
综合评分:
积分/C币:3
VIP会员动态
CSDN下载频道资源及相关规则调整公告V11.10
下载频道用户反馈专区
下载频道积分规则调整V1710.18
spring mvc+mybatis+mysql+maven+bootstrap 整合实现增删查改简单实例.zip
资源所需积分/C币
当前拥有积分
当前拥有C币
输入下载码
为了良好体验,不建议使用迅雷下载
ffmpeg文件生成m3u8文件及ts切片程序_1
会员到期时间:
剩余下载个数:
剩余积分:0
为了良好体验,不建议使用迅雷下载
积分不足!
资源所需积分/C币
当前拥有积分
您可以选择
程序员的必选
绿色安全资源
资源所需积分/C币
当前拥有积分
当前拥有C币
为了良好体验,不建议使用迅雷下载
资源所需积分/C币
当前拥有积分
当前拥有C币
为了良好体验,不建议使用迅雷下载
资源所需积分/C币
当前拥有积分
当前拥有C币
您的积分不足,将扣除 10 C币
为了良好体验,不建议使用迅雷下载
无法举报自己的资源
你当前的下载分为234。
你还不是VIP会员
开通VIP会员权限,免积分下载
你下载资源过于频繁,请输入验证码
您因违反CSDN下载频道规则而被锁定帐户,如有疑问,请联络:!
若举报审核通过,可返还被扣除的积分
被举报人:
zhuweigangzwg
举报的资源分:
请选择类型
资源无法下载 ( 404页面、下载失败、资源本身问题)
资源无法使用 (文件损坏、内容缺失、题文不符)
侵犯版权资源 (侵犯公司或个人版权)
虚假资源 (恶意欺诈、刷分资源)
含色情、危害国家安全内容
含广告、木马病毒资源
*详细原因:
ffmpeg文件生成m3u8文件及ts切片程序_1ffmpeg切割TS脚本带加密 - 开源中国社区
当前访客身份:游客 [
当前位置:
发布于 日 15时,
爸爸给你们整理好了,像我在博客里说的。工作中我最讨厌两种人,一个是不懂得分享,有技术拿劲儿不告诉别人的人。另一种就是不懂得思考,上来就问的,说这个也不会那个也不会的人。
代码片段(1)
test.sh&~&2KB&&&&
#!/bin/bash
# Be warned!!! there is an "rm -r" at the end of this script.
I do not guarantee anything, in particular that (mis)use won't damage something important.
# Use at your own risk!
# Copyright public domain
# Derived from: http://dryize.wordpress.com//protected-hls-using-ffmpeg-and-openssl/
# Exit on errors
keyFile='video.key'
vidFile="$1"
playList='cc.m3u8'
# Must end with .m3u8!
splitFilePrefix='stream'
wKeyPath="$3/$keyFile"
# Only run if the video file is readable and is not an irregular file
if [ -f "$vidFile" -a -r "$vidFile" ]; then
# Whole rest of pro exits 2 at the end if the above fails.
# If folder exists, add it to our paths
if [ -d "$2" ]; then
outDir="$2"
# Try to make the directory
mkdir "$2" || exit 1
outDir="$2"
tempDir="$outDir/.$$_tmp"
keyFile="$outDir/$keyFile"
mkdir $tempDir
# It is deleted later
# Stuff from the original script
openssl rand 16 & $keyFile
# I'm not sure if I have the quoting right on this. If not, try removing the double quotes in the middle.
encryptionKey=`cat $keyFile | hexdump -e '16/1 "%02x"'`
# Here's where I run ffmpeg
ffmpeg -i "$vidFile" -c copy -map 0 -bsf:v
h264_mp4toannexb
global_header -f segment -segment_time 10 -segment_list_size 0 \
-segment_list "$tempDir/$playList" -segment_format mpegts "$tempDir/$splitFilePrefix"%d.ts
# N.B. I question some of those parameters, such as segment_time, but this is not my command.
# I also had to use libfdk_aac instead of libvo_aacenc
# I thought m3u8 playlists needed full URLs, but he doesn't include them.
numberOfTsFiles=`ls "$tempDir/$splitFilePrefix"*.ts | wc -l`
for (( i=0; i&$numberOfTsF i++ ))
initializationVector=`printf '%032x' $i`
openssl aes-128-cbc -e -in "$tempDir/$splitFilePrefix"$i.ts \
-out "$outDir/$splitFilePrefix"$i.ts -nosalt -iv $initializationVector -K $encryptionKey
# Write something to the middle of the head of the playlist
head -2 "$tempDir/$playList"
echo '#EXT-X-KEY:METHOD=AES-128,URI=''"'"$wKeyPath"'"'
echo '#EXT-X-MEDIA-SEQUENCE:0'
egrep "$tempDir/$playList" -vie '#EXT-X-MEDIA-SEQUENCE:' \
| tail -n +3
} & "$outDir/$playList"
# Get rid of the unencrypted files and unmodified playlist
rm -rf "$tempDir"
# Close the opening if
else exit 2
开源中国-程序员在线工具:
相关的代码(21)
[Shell/批处理]
[Shell/批处理]
[Shell/批处理]
[Shell/批处理]
[Shell/批处理]
[Shell/批处理]
[Shell/批处理]
[Shell/批处理]
0回/1500阅
[Shell/批处理]
[Shell/批处理]
开源从代码分享开始
MAJIK的其它代码ffmpeg把ts文件转m3u8并切片
时间: 16:20:06
&&&& 阅读:235
&&&& 评论:
&&&& 收藏:0
Linux_x86_64流媒体环境:nginx +&EasyDarwin-master
客户端播放器:VLC media player
下载windows下的ffmepg二进制版本,请进网站|static&最新版本,无需自己编译。
下载完解压后,需要配置ffmepg的path环境变量。Path=%Path%;E:\ffmpeg--git-e9aea6d-win64-static\ffmpeg--git-e9aea6d-win64-static\bin
下面流转换和切片的方式:
ffmpeg -ss 01:00:00 -i input_file_h264.mp4 -vcodec copy -acodec copy -t 00:06:00 output_file.mp4
------------------------------
利用ffmpeg将已有的视频文件转换成ts文件
  ffmpeg -y -i &in file& -vcodec copy -acodec copy -vbsf h264_mp4toannexb &output file&
其中in file为待转换的视频文件,比如input.mov,output file为转换后的文件,要命名为output.ts
利用segmenter将转换好的ts文件切割成多个ts片,并生成.m3u8的索引文件
  ./segmenter -i out.ts -n 10 -p segmenter_test -m test.m3u8 -u #需要安装segmenter包
i表示输入文件,n表示切割10秒,p表示切割文件的前缀。m表示生成的m3u8文件名,u表示这些切割后的文件处于web server的哪个目录下
PS:实践过程中发现一个问题,就是切片之后,最后一段ts不管是不是10s,同样会按10s去切,导致切好后的视频最后一段会加上去几秒的黑段来补足10s,原因是segmenter.c中的程序写的还有缺陷,修正方法如下:
---------------------------ffmepg把ts文件转m3u8并切片:ffmpeg -i xx.ts -c copy -map 0 -f segment -segment_list playlist.m3u8 -segment_time 10 output%03d.ts
大家都说HLS代表future,rtsp已经是过去式了。
怎么分割并转换为h264编码呢?先把ts流中的格式转换对,可以用以下命令试试:ffmpeg -i your.ts -acodec copy -vcodec libx264 new.h264.ts
-----------------------------
ffmpeg -i xxxxx.ts -hls_time 10 -hls_list_size 10 -f hls xxxx.m3u8
-----------------------------
以下是笔者的方法:
ffmpeg -y -i bs.mp4 -vcodec copy -acodec copy -vbsf h264_mp4toannexb bs2.ts
ffmpeg -i bs2.ts -c copy -map 0 -f segment -segment_list playlist.m3u8 -segment_time 3 output%03d.ts
&标签:原文地址:http://www.cnblogs.com/shengs/p/4977662.html
&&国之画&&&& &&&&chrome插件&&
版权所有 京ICP备号-2
迷上了代码!随笔 - 150&
文章 - 0&评论 - 0&trackbacks - 0
1、将MP4转成m3u8
ffmpeg -i test.mp4 -codec copy -bsf h264_mp4toannexb test.ts
2、将ts转成m3u8
网上很多垃圾文章推荐segmenter工具,但用的时候,3.5G的ts文件丢了一半的数据,于是想到了ffmpeg转。在国外网站找到命令,一句话搞定,没报半句错:ffmpeg -i 12生肖.ts -c copy -map 0 -f segment -segment_list playlist.m3u8 -segment_time 10 output%03d.ts
顺便共享给各位国内的同仁,免得深受其苦。毕竟,大家都说HLS代表future,rtsp已经是过去式了。
阅读(...) 评论()在 SegmentFault,学习技能、解决问题
每个月,我们帮助 1000 万的开发者解决各种各样的技术问题。并助力他们在技术能力、职业生涯、影响力上获得提升。
问题对人有帮助,内容完整,我也想知道答案
问题没有实际价值,缺少关键内容,没有改进余地
需求场景:
来源视频格式、大小、码率、分辨率未知(不统一);
要求支持多个平台(PC、手机APP、网页)
输出统一格式、大小、码率、分辨率;
早期的视频转码为MP4格式,会有个问题,当视频文件比较大时,就比较坑;目前考虑把视频输出为多个.ts格式的视频片段和一个m3u8格式的.ts文件列表;
在网上查到可以使用ffmpeg以下命令转换:
ffmpeg -i Wildlife.wmv -codec:v libx264 -codec:a mp3 -map 0 -f ssegment -segment_format mpegts -segment_list ./m3u8/index.m3u8 -segment_time 10 ./m3u8/’%03d.ts’
可以成功把视频转为.ts并生成.m3u8索引文件,但是使用video标签播放时不能播放(safari浏览器)
使用index.m3u8不能播放
&video src="m3u8/index.m3u8"&&/video&
使用ts文件可以播放
&video src="m3u8/0.ts"&&/video&
感谢大神 @itlr的提醒,应该是http地址引用m3u8文件:
&video src="http://localhost/m3u8/index.m3u8"&&/video&
问题2:(未解决)
可以播放以后又遇到了新的问题:
直接通过http引用,可以播放但是视频不显示水印
&video src="http://localhost/m3u8/index.m3u8"&&/video&
可以播放也可以显示水印
&video src="m3u8/0.ts"&&/video&
转码时的添加水印的参数(图片和文字水印都试过,结果一样):
# 文字水印
-vf "drawtext=text=Teachmyself:fontfile=/Library/Fonts/Arial.ttf:fontsize=16:fontcolor=yellow@0.8:x=w-tw-16:y=h-th-16"
# 图片水印:
-vf "movie=watermark.png [wm]; [in][wm] overlay=main_w-overlay_w-16:main_h-overlay_h-16 [out]"
答案对人有帮助,有参考价值
答案没帮助,是错误的答案,答非所问
MimeType 要对,video tag和服务器端
.M3U8 application/x-mpegURL or vnd.apple.mpegURL
.ts video/MP2T
答案对人有帮助,有参考价值
答案没帮助,是错误的答案,答非所问
试试用保利威视统一处理好了。
该答案已被忽略,原因:屏蔽无效回答
同步到新浪微博
分享到微博?
关闭理由:
删除理由:
忽略理由:
推广(招聘、广告、SEO 等)方面的内容
与已有问题重复(请编辑该提问指向已有相同问题)
答非所问,不符合答题要求
宜作评论而非答案
带有人身攻击、辱骂、仇恨等违反条款的内容
无法获得确切结果的问题
非开发直接相关的问题
非技术提问的讨论型问题
其他原因(请补充说明)
我要该,理由是:
在 SegmentFault,学习技能、解决问题
每个月,我们帮助 1000 万的开发者解决各种各样的技术问题。并助力他们在技术能力、职业生涯、影响力上获得提升。}

我要回帖

更多关于 ts文件 m3u8 key 合并 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信