huangdali / m3u8manger Goto Github PK
View Code? Open in Web Editor NEWM3U8管理器,M3U8格式视频下载,支持点播下载,直播缓存
M3U8管理器,M3U8格式视频下载,支持点播下载,直播缓存
如何获取正在进行的下载任务信息,因为不可能一直在下载管理页面,如果用户退出后想在后台下载,过会再进下载任务管理页面查看呢
点击合并按钮直接崩溃退出
.
希望能增加多任务的demo
07-27 14:43:37.587 13515-13515/com.ttxinli.ttxinli E/DownloadController: │ downloadM3U8onFailure: ffmpeg version n3.0.1 Copyright (c) 2000-2016 the FFmpeg developers
07-27 14:43:37.587 13515-13515/com.ttxinli.ttxinli E/DownloadController: │ built with gcc 4.8 (GCC)
07-27 14:43:37.587 13515-13515/com.ttxinli.ttxinli E/DownloadController: │ configuration: --target-os=linux --cross-prefix=/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/bin/arm-linux-androideabi- --arch=arm --cpu=cortex-a8 --enable-runtime-cpudetect --sysroot=/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/sysroot --enable-pic --enable-libx264 --enable-libass --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-fontconfig --enable-pthreads --disable-debug --disable-ffserver --enable-version3 --enable-hardcoded-tables --disable-ffplay --disable-ffprobe --enable-gpl --enable-yasm --disable-doc --disable-shared --enable-static --pkg-config=/home/vagrant/SourceCode/ffmpeg-android/ffmpeg-pkg-config --prefix=/home/vagrant/SourceCode/ffmpeg-android/build/armeabi-v7a --extra-cflags='-I/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/include -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -fstack-protector-all' --extra-ldflags='-L/home/vagrant/SourceCode/ffmpeg-android/toolchain-android/lib -Wl,-z,relro -Wl,-z,now -pie' --extra-libs='-lpng -lexpat -lm' --extra-cxxflags=
07-27 14:43:37.587 13515-13515/com.ttxinli.ttxinli E/DownloadController: │ libavutil 55. 17.103 / 55. 17.103
07-27 14:43:37.587 13515-13515/com.ttxinli.ttxinli E/DownloadController: │ libavcodec 57. 24.102 / 57. 24.102
07-27 14:43:37.587 13515-13515/com.ttxinli.ttxinli E/DownloadController: │ libavformat 57. 25.100 / 57. 25.100
07-27 14:43:37.587 13515-13515/com.ttxinli.ttxinli E/DownloadController: │ libavdevice 57. 0.101 / 57. 0.101
07-27 14:43:37.587 13515-13515/com.ttxinli.ttxinli E/DownloadController: │ libavfilter 6. 31.100 / 6. 31.100
07-27 14:43:37.587 13515-13515/com.ttxinli.ttxinli E/DownloadController: │ libswscale 4. 0.100 / 4. 0.100
07-27 14:43:37.587 13515-13515/com.ttxinli.ttxinli E/DownloadController: │ libswresample 2. 0.101 / 2. 0.101
07-27 14:43:37.587 13515-13515/com.ttxinli.ttxinli E/DownloadController: │ libpostproc 54. 0.100 / 54. 0.100
07-27 14:43:37.587 13515-13515/com.ttxinli.ttxinli E/DownloadController: │ https protocol not found, recompile FFmpeg with openssl, gnutls,
07-27 14:43:37.587 13515-13515/com.ttxinli.ttxinli E/DownloadController: │ or securetransport enabled.
07-27 14:43:37.587 13515-13515/com.ttxinli.ttxinli E/DownloadController: │ https://preview.mypsy365.com/app_dev.php/hls/232/stream/sd/aF6F9qgiZqZtBXHlMpYlxUFEmPKaxaTc.m3u8?1532673817: Protocol not found
不支持下面的这种m3u8格式下载
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-ALLOW-CACHE:YES
#EXT-X-TARGETDURATION:19
#EXT-X-KEY:METHOD=AES-128,URI="http://www.mypsy365.com/hls/219/clef/LvU3ngZQ2stq2pXw7G69XxG4tyqr1r5y",IV=0x6e8b379f08fed6340d11025cb016e095
#EXTINF:7.800000,
http://ese1a1b2c8d5xn-pub.pub.qiqiuyun.net/headLeader-0/20151116032554-1l3sw31kc9pcgcs0/08240ac0d835086d_sd_seg_0_68d3b7d825fdcc9b55ff2a1d5676c8f5?schoolId=11285&fileGlobalId=1c17ce8bd5124ca2b358984f4a6bae88
#EXT-X-DISCONTINUITY
#EXT-X-KEY:METHOD=AES-128,URI="http://www.mypsy365.com/hls/149/clef/5RsxQElityxxsB4EQPx9m6o3YK5H06Gq",IV=0xb1cab025e664c613360378d3288fb116
#EXTINF:18.880000,
http://ese1a1b2c8d5xn-pub.pub.qiqiuyun.net/courselesson-75/20151104074940-r83w2x6genkockcg/aacd2acbddb2dfb9_sd_seg_0_0f87d35be12ca76fa47ec48156ecfbeb?schoolId=11285&fileGlobalId=1c17ce8bd5124ca2b358984f4a6bae88
#EXT-X-KEY:METHOD=AES-128,URI="http://www.mypsy365.com/hls/149/clef/5RsxQElityxxsB4EQPx9m6o3YK5H06Gq",IV=0x2e1ef34daa2713b4ab824666ef690703
#EXTINF:10.000000,
http://ese1a1b2c8d5xn-pub.pub.qiqiuyun.net/courselesson-75/20151104074940-r83w2x6genkockcg/aacd2acbddb2dfb9_sd_seg_1_1df26d56636550142dbc045a05bed196?schoolId=11285&fileGlobalId=1c17ce8bd5124ca2b358984f4a6bae88
#EXT-X-KEY:METHOD=AES-128,URI="http://www.mypsy365.com/hls/149/clef/5RsxQElityxxsB4EQPx9m6o3YK5H06Gq",IV=0x6115553f05719264de614c82bfcb6cfd
#EXTINF:10.000000,
http://ese1a1b2c8d5xn-pub.pub.qiqiuyun.net/courselesson-75/20151104074940-r83w2x6genkockcg/aacd2acbddb2dfb9_sd_seg_2_404e07d5bcb53ae5878c2cfce3bd4067?schoolId=11285&fileGlobalId=1c17ce8bd5124ca2b358984f4a6bae88
#EXT-X-KEY:METHOD=AES-128,URI="http://www.mypsy365.com/hls/149/clef/5RsxQElityxxsB4EQPx9m6o3YK5H06Gq",IV=0xe0236536ba85ce9acfc1c548404ad38b
#EXT-X-ENDLIST
可以直接播放 网络m3u8?
单纯的将每个分片合并为一个,下载的视频时间显示异常,而且不同拖动定位
是否可以兼容一下MP4等格式的或者有什么方法判断一下url是否可以使用m3u8Manger下载,试了一下使用MP4地址调用getM3U8Info会有问题,oom
下载完成合并时发生,1300多切片,运行在android
某些视频的连接是需要header的,希望能添加这个功能
一般电影链接有几千个ts,但是每次获取M3U8InfoManger.getInstance().getM3U8Info,只能获取几十个
2个问题:ts切片顺序不对,合并的视频需要再编码,时间轨不对。
m3u8地址:http://223.82.250.72/ysten-business/live/cctv-1/1.m3u8
错误位置:MUtils.java 第53行
建议:将此处的
if (line.endsWith(",")) { line = line.substring(0, line.length() - 1); }
改为
if (line.contains(",")){ line=line.substring(0,line.indexOf(",")); }
在您的demo上替换了url地址,后点击下载按钮
E/onStart(Main2Activity.java:141): 1001开始下载了
E/onError(Main2Activity.java:148): 1001出错了java.lang.Throwable: 404
E/onDownloading(Main2Activity.java:103): 1001下载中.....itemFileSize=0 totalTs=627 curTs=1
E/onDownloading(Main2Activity.java:103): 1001下载中.....itemFileSize=0 totalTs=627 curTs=2
E/onDownloading(Main2Activity.java:103): 1001下载中.....itemFileSize=0 totalTs=627 curTs=3
E/onStart(Main2Activity.java:141): 1001开始下载了
E/onError(Main2Activity.java:148): 1001出错了java.lang.Throwable: 404
E/onDownloading(Main2Activity.java:103): 1001下载中.....itemFileSize=0 totalTs=627 curTs=4
E/onError(Main2Activity.java:148): 1001出错了java.lang.Throwable: 404
E/onDownloading(Main2Activity.java:103): 1001下载中.....itemFileSize=0 totalTs=627 curTs=6
E/onError(Main2Activity.java:148): 1001出错了java.lang.Throwable: 404
E/onDownloading(Main2Activity.java:103): 1001下载中.....itemFileSize=0 totalTs=627 curTs=6
fork了一个分支做了一些调整
RT
如题
你好,下载m3u8文件是没问题,能否增加合并ts文件和播放ts文件,播放ts文件的原理是什么。像腾讯视频一样
有个错误
java.lang.NumberFormatException: For input string: "http://vali.cp31.ott.cibntv.net/657336C1E3B4571B1153A6E28/0300011501576AD30D0029132629A1DFA5FB02-87CA-5E89-7D82-FF5862B03A33.flv.ts?sid=050260411822420e45e55_01&sign=2ed144f976fbdd7c0770ee747e361395&ctype=50&ts_start=0.0&ts_end=11"
at java.lang.Long.parseLong(Long.java:443)
at java.lang.Long.parseLong(Long.java:485)
at com.hdl.m3u8.bean.M3U8Ts.getLongDate(M3U8Ts.java:44)
at com.hdl.m3u8.bean.M3U8.getStartTime(M3U8.java:63)
at com.hdl.m3u8.utils.MUtils.getLimitM3U8Ts(MUtils.java:125)
at com.hdl.m3u8.M3U8Manger.download(M3U8Manger.java:284)
at com.hdl.m3u8.M3U8Manger.access$1000(M3U8Manger.java:26)
at com.hdl.m3u8.M3U8Manger$3.run(M3U8Manger.java:195)
11-25 15:01:59.270 5030-5296/com.hdl.m3u8demo E/AndroidRuntime: FATAL EXCEPTION: Thread-5
Process: com.hdl.m3u8demo, PID: 5030
java.lang.OutOfMemoryError: Failed to allocate a 1024 byte allocation with 9433776 free bytes and 8MB until OOM; failed due to fragmentation (required continguous free 8192 bytes for a new buffer where largest contiguous free 0 bytes)
at java.lang.StringFactory.newStringFromChars(StringFactory.java:218)
at java.io.BufferedReader.readLine(BufferedReader.java:367)
at java.io.BufferedReader.readLine(BufferedReader.java:400)
at com.hdl.m3u8.utils.MUtils.parseIndex(MUtils.java:46)
at com.hdl.m3u8.M3U8InfoManger$2.run(M3U8InfoManger.java:62)
同事多个任务下载,如何判断progress返回的进度是属于哪一个任务的?
这是一个测试地址:
http://cn1.fa1244.cn/hls/20190516/6d271eaa73b2e4cb51d13831b0c1ab4c/1557976262/index.m3u8
类似这种的,返回的切片跟basepath有一部分url是重复,需要去除重复路径,否则报404错误。
basepath是这个,
http://cn1.fa1244.cn/hls/20190516/6d271eaa73b2e4cb51d13831b0c1ab4c/1557976262/
而切片是这样的,
/hls/20190516/6d271eaa73b2e4cb51d13831b0c1ab4c/1557976262/film_00000.ts
在M3U8DownloadTask类下280行左右拼接路径时需要做去重处理,其他地方还没发现,望楼主采纳。
在IntentService种使用会有 java.lang.IllegalStateException Handler sending message to a Handler on a dead thread
我自己改动了mHandler
private Handler mHandler = new Handler(Looper.getMainLooper())
实际项目中都是加密分片。都不能直接播放ts文件。还是需要用m3u8文件才能播放,如果要本地播放的还需要写有索引和密匙的m3u8文件才能播放。
下载一个超过十分钟的m3u8的视频,在播放的时候显示只有一分多钟,但是时间到头后还会一直播,音画会出现不同步的情况,请问您知道是为什么吗
the old code is:
String basepath = realUrl.substring(0, realUrl.lastindexOf("/") + 1);
but this code may get the wrong path :
好像没有获取已缓存的大小,也没有提供如何删除缓存?建议可以加上。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.