2024-09-25 06:06 点击次数:150
第一步新建一个java类QSV麻豆 视频,构造函数传入需要分解的文献称号。
通用要害 逐字节读取文献咱们需要一一字节读取文献,这边就需要jdk自带的类RandomAccessFile,先界说一个通用函数,输出偏移位置和字节大小赢得字节数组。
字节数组转16进制字符串 字节数组转int 老版块解密算法老版块解密要害相比浅近,先看下C的写法:
不错径直用byte数组和long类型替换c的内存界说,这边没问题时因为莫得位移算法,背面新版块解密算法会讲到。
新版块解密算法新版块解密算法相比复杂,一样先看下c的写法:
这边介意c的写法有位移,界说的DWORD占32位内存,而java与之对应的int类型亦然占32位内存,取值鸿沟是-2^31~2^31-1(即-2147483648~2147483647),若是超出这个鸿沟java需要用long,而long占64位内存取反和位移王人是按64位进行的与C的32位取反位移设想成果确定有各异。
比如:2147483648,诊治位二进制暗示:10000000000000000000000000000000,C的写法由于DWORD占32位内存,左移一位后超出32为故就形成00000000000000000000000000000000,而java一经超出了int的取值鸿沟,只可用long界说,由于long占64位,左移一位不会超出,成果也就不一样了。
又比如:9147483648,转为二进制暗示:1000100001001110111000011000000000,一经超出32位,存到DWORD中的只保留右边的32位麻豆 视频,即00100001001110111000011000000000,左移认为形成01000010011101110000110000000000,转为10进制为1115098112,而java袭取long界说不会超出64位,左移成果位10001000010011101110000110000000000,转为十进制暗示为18294967296,与C的成果收支较大。那么有概念处理吗,谜底确定是有的,咱们需要重新写一个位移算法。
有了新界说的位移算法,解密算法就不错修改为:
赢得QSV头部信息上一篇著述讲到,头部信息共90个字节,signature(10byte)+version(4byte)+vid(16byte)+_unknown1(4byte)+_unknown2(32byte)+_unknown3(4byte)+_unknown4(4byte)+json_offset(8byte)+json_size(4byte)+nb_indices(4byte)
运行成果:
signature:QIYI VIDEO version:2 vid:A90EA47D4333331BB85F331C1130504C _unknown1:01000000 _unknown2:0000000000000000000000000000000000000000000000000000000000000000 _unknown3:01000000 _unknown4:01000000 json_offset:0x167 json_size:0x1d81 nb_indices:0x7
赢得json数据赢得json数据需要先赢得头部信息纪录的json的偏移位置和字节大小,赢得到的字节数组再通过老版块解密算法解密即可。
运行成果:
json_offset:0x167 json_size:0x1d81 QYVI {"qsv_info":{"ad":{},"aid":"3644740799867701","bid":600,"dr":-1,"independentaudio":true,"m3u8":"","pano":{"type":1},"qsvinfo_version":2,"sdv":"","st":"","thdt":1,"tht":0,"title":"","title_tail_info":{"bt":99,"bts":-1,"et":2621,"ete":-1,"fe":1,"le":0},"tvid":"3185901936393500","vd":{"seg":{"duration":["376140","365508","370300","371477","368311","368308","554319"],"rid":["a8c47c2906b88ae47e8503c96dae0494","4c8578cecbdfa3137a61b7e2bd1c68dc","4bc76f9b4d4ce995f40b42c467d206f8","8ed13ccd56aa2367f5eaabee12043d89","247b4612415c5b452f5965894a967e19","309400bef063cfd6baf19feb0d4a73a9","9771b1042cabfc9828767a3d0350f655"],"size":["75624801","84329329","90135782","82093900","91974933","75298884","111399115"]},"time":{"et":"2621000","st":"99000"}},"vi":"{\"writer\":\"\",\"authors\":\"\",\"upOrder\":36,\"rewardAllowed\":0,\"fl\":[],\"allowEditVVIqiyi\":0,\"isPopup\":1,\"payMark\":0,\"an\":\"风吹半夏\",\"pvu\":\"\",\"subType\":1,\"rewardMessage\":\"\",\"ipLimit\":1,\"pubTime\":\"1673306651000\",\"mainActorRoles\":[],\"up\":\"2023-01-17 20:20:02\",\"un\":\"\",\"qiyiProduced\":1,\"platforms\":[],\"vn\":\"风吹半夏第1集\",\"plc\":{\"4\":{\"downAld\":1,\"coa\":1},\"40\":{\"downAld\":1,\"coa\":1},\"10\":{\"downAld\":1,\"coa\":1},\"5\":{\"downAld\":1,\"coa\":1},\"41\":{\"downAld\":1,\"coa\":1},\"22\":{\"downAld\":1,\"coa\":1},\"32\":{\"downAld\":1,\"coa\":1},\"11\":{\"downAld\":1,\"coa\":1},\"12\":{\"downAld\":1,\"coa\":1},\"7\":{\"downAld\":1,\"coa\":1},\"13\":{\"downAld\":1,\"coa\":1},\"14\":{\"downAld\":1,\"coa\":1},\"91\":{\"downAld\":1,\"coa\":1},\"34\":{\"downAld\":1,\"coa\":1},\"9\":{\"downAld\":1,\"coa\":1},\"6\":{\"downAld\":1,\"coa\":1},\"16\":{\"downAld\":1,\"coa\":1},\"17\":{\"downAld\":1,\"coa\":1},\"27\":{\"downAld\":1,\"coa\":1},\"28\":{\"downAld\":1,\"coa\":1},\"18\":{\"downAld\":1,\"coa\":1},\"29\":{\"downAld\":1,\"coa\":1},\"1\":{\"downAld\":1,\"coa\":1},\"50\":{\"downAld\":1,\"coa\":1},\"31\":{\"downAld\":1,\"coa\":1},\"15\":{\"downAld\":1,\"coa\":1},\"2\":{\"downAld\":1,\"coa\":1},\"3\":{\"downAld\":1,\"coa\":1},\"21\":{\"downAld\":1,\"coa\":1},\"30\":{\"downAld\":1,\"coa\":1},\"19\":{\"downAld\":1,\"coa\":1},\"8\":{\"downAld\":1,\"coa\":1},\"20\":{\"downAld\":1,\"coa\":1}},\"sm\":0,\"st\":200,\"startTime\":99,\"showChannelId\":2,\"vu\":\"http:\\/\\/www.iqiyi.com\\/v_uvxuws1kkw.html\",\"povu\":\"\",\"ppsuploadid\":0,\"qiyiPlayStrategy\":\"非会员逐日20:00转免1集\",\"ar\":\"内地\",\"cc\":0,\"videoQipuId\":3185901936393500,\"albumQipuId\":3644740799867701,\"pano\":{\"type\":1},\"subt\":\"许半夏帮童骁骑驱霉运\",\"endTime\":2621,\"cpa\":1,\"userVideocount\":0,\"es\":36,\"plg\":2774,\"stl\":{\"d\":\"http:\\/\\/meta.video.iqiyi.com\",\"stl\":[]},\"subKey\":\"3644740799867701\",\"tvFocuse\":\"赵丽颖欧豪联袂创业\",\"qtId\":0,\"ty\":0,\"ppsInfo\":{\"shortTitle\":\"风吹半夏第1集\",\"name\":\"风吹半夏第1集\"},\"sid\":0,\"etm\":\"\",\"keyword\":\"风吹半夏\",\"pturl\":\"\",\"a\":\"\",\"isTopChart\":0,\"idl\":0,\"albumAlias\":\"许半夏帮童骁骑驱霉运\",\"stm\":\"\",\"pd\":1,\"tags\":[],\"coa\":0,\"c\":2,\"producers\":\"\",\"nurl\":\"\",\"tvEname\":\"wild bloom\",\"uid\":\"0\",\"asubt\":\"\",\"d\":\"傅东育|毛溦\",\"vid\":\"a90ea47d4333331bb85f331c1130504c\",\"dts\":\"20230117202002\",\"editorInfo\":\"\",\"tvSeason\":0,\"ntvd\":3185901936393500,\"vpic\":\"http:\\/\\/pic6.iqiyipic.com\\/image\\/20221127\\/e2\\/52\\/v_170312139_m_601_m1.jpg\",\"vType\":0,\"cType\":1,\"payMarkUrl\":\"\",\"apic\":\"http:\\/\\/pic8.iqiyipic.com\\/image\\/20230104\\/6c\\/00\\/a_100498846_m_601_m26.jpg\",\"shortTitle\":\"风吹半夏第1集\",\"tvid\":3185901936393500,\"aid\":3644740799867701,\"au\":\"http:\\/\\/www.iqiyi.com\\/a_yq6d69gtw9.html\",\"tvPhase\":0,\"ifs\":0,\"is\":0,\"tpl\":[],\"actors\":[],\"isVip\":\"\",\"votes\":[],\"previewImageUrl\":\"http:\\/\\/preimage3.iqiyipic.com\\/preimage\\/20230110\\/6a\\/a6\\/v_170312139_m_611_m6.jpg\",\"e\":\"\",\"cnPremTime\":0,\"s\":\"\",\"ma\":\"赵丽颖|欧豪|李光洁|刘威|柯蓝|任重|冯嘉怡|孙千|黄澄澄|是安|宋熹|王西|黄义威|王劲松|刘威葳|尤靖茹|林鹏(大陆男演员)|郝平|淮文|颜世魁|薛淑杰|刘硕|丁冠中|豆艺坤|寇钟吁|杨德民|傅宜箴|朱超艺|黄子琪|荣飞|田玲|周小镔|孔琳|方晓莉|陈创|韩朔|高远\",\"supName\":\"\",\"sc\":0,\"categoryKeywords\":\"电视剧,3644740799867701,0,http:\\/\\/list.iqiyi.com\\/www\\/2\\/------------------.html 好处,12791537149997,2,http:\\/\\/list.iqiyi.com\\/www\\/2\\/-12791537149997-----------------.html 浙江卫视,20291787825994,0,http:\\/\\/list.iqiyi.com\\/www\\/2\\/------------------.html 家庭,23757144288056,2,http:\\/\\/list.iqiyi.com\\/www\\/2\\/-23757144288056-----------------.html 言情,23789230921965,2,http:\\/\\/list.iqiyi.com\\/www\\/2\\/-23789230921965-----------------.html 励志,29717236536467,2,http:\\/\\/list.iqiyi.com\\/www\\/2\\/-29717236536467-----------------.html 商战,32284167249109,2,http:\\/\\/list.iqiyi.com\\/www\\/2\\/-32284167249109-----------------.html 剧情,37979544767779,2,http:\\/\\/list.iqiyi.com\\/www\\/2\\/-37979544767779-----------------.html 王人市,80141381722890,2,http:\\/\\/list.iqiyi.com\\/www\\/2\\/-80141381722890-----------------.html 内地,80526421329786,0,http:\\/\\/list.iqiyi.com\\/www\\/2\\/------------------.html 爱情,87328787718281,2,http:\\/\\/list.iqiyi.com\\/www\\/2\\/-87328787718281-----------------.html\",\"onlineStatus\":1,\"mdown\":0,\"bmsg\":{\"t\":\"20230117202002\",\"f\":\"web\",\"mid\":\"\",\"sp\":\"26173601,\"},\"nvid\":\"8ec7f862076f40ee17c908e2bbc3fae2\",\"flpps\":[],\"supType\":\"\",\"lg\":2,\"is3D\":0,\"bossStatus\":0,\"isDisplayCircle\":0,\"actorRoles\":[],\"exclusive\":1,\"circle\":{\"type\":0,\"id\":0},\"commentAllowed\":1,\"tg\":\"忠犬 大女主 好处 工业强国 毒舌 重组家庭 渣男 浙江卫视 家庭 言情 历害总裁 御姐 励志 个东谈主成长 虐恋 双强 通俗语 商战 能人 剧情 出轨 昆玉反目 女强东谈主 爽剧 初恋 后生高兴 热血 女性励志 群像 个东谈主高兴 接地气 女后生 大佬 原生家庭 猪队友 王人市 内地 组团 爱情\",\"info\":\"1996年的秋天,阳光炫目。许半夏开着一辆桑塔纳,接着刚出狱的童骁骑驶往鹭州出差。一齐上童骁骑闭口藏舌,二东谈主之间懊恼莫名。到了栈房后,许半夏的教悔很明晰:洗浴,看电视,休眠,第二天一早,她来接童骁骑一齐出差。童骁骑点点头,在许半夏离开后,他启动洗浴,记念也回到了五年前……\\n1991年的一个雨夜,童骁骑因为急着给姆妈筹医药费,撬了一堆下水井盖,蹬着三轮车拉到了许半夏和小陈的废品站。小陈认定童骁骑即是个骗子,不肯赞理,但和缓的半夏敬佩童骁骑,给了他钱,何况三个东谈主一大早一齐把井盖王人送了且归。童骁骑为表谢意,应允替二东谈主作念事。许半夏提到当地钢厂有许多废了的下脚料,他们不错去收,但缺一辆大车。于是司机班出生的童骁骑真实把厂里的东风暗暗开了出来,三东谈主晃晃悠悠进了钢厂,挣到了东谈主生的第一桶金,但童骁骑也因为暗自用车被厂里开除了。回到废品站的童骁骑凉了半截,许半夏却安危谈恰好,今后他们三个东谈主就一块儿干,而这些钱即是他们的第一笔结伴资金。\",\"supId\":0,\"issueTime\":0,\"dtype\":3,\"producer\":\"\",\"presentor\":[],\"followerCount\":0}","vid":"a90ea47d4333331bb85f331c1130504c","videotype":0}}s
索要视频信息赢得视频信息,最初要先索要索引信息,凭证索引信息中的偏移位置和字节大小赢得,赢得到的字节数组前1024个字节需要解密,凭证头部信息中的version判断,若是是1则用老版块算法解密,若是是2则用新版块算法解密。
一个QSV文献包含多段视频数据,已发现的视频局势有flv(旧版客户端)、mpeg-ts(新版客户端)。不错通过前三个字节判断,若是前三个字节转字符串为FLV则为FLV局势。
运行成果:
nb_indices:0x7 _unknown_flag:7F _codetable:A8C47C2906B88AE47E8503C96DAE0494,segment_offset:0x1ee8,segment_size:0x481f161 export:D:\workspace\c\风吹半夏第1集-蓝光1080P-第1段.flv _codetable:4C8578CECBDFA3137A61B7E2BD1C68DC,segment_offset:0x4821049,segment_size:0x506c371 export:D:\workspace\c\风吹半夏第1集-蓝光1080P-第2段.flv _codetable:4BC76F9B4D4CE995F40B42C467D206F8,segment_offset:0x988d3ba,segment_size:0x55f5ce6 export:D:\workspace\c\风吹半夏第1集-蓝光1080P-第3段.flv _codetable:8ED13CCD56AA2367F5EAABEE12043D89,segment_offset:0xee830a0,segment_size:0x4e4a74c export:D:\workspace\c\风吹半夏第1集-蓝光1080P-第4段.flv _codetable:247B4612415C5B452F5965894A967E19,segment_offset:0x13ccd7ec,segment_size:0x57b6d15 export:D:\workspace\c\风吹半夏第1集-蓝光1080P-第5段.flv _codetable:309400BEF063CFD6BAF19FEB0D4A73A9,segment_offset:0x19484501,segment_size:0x47cf844 export:D:\workspace\c\风吹半夏第1集-蓝光1080P-第6段.flv _codetable:9771B1042CABFC9828767A3D0350F655,segment_offset:0x1dc53d45,segment_size:0x6a3d0cb export:D:\workspace\c\风吹半夏第1集-蓝光1080P-第7段.flv
参考贵府本文参考开源名堂qsv2flv,名堂地址:https://github.com/btnkij/qsv2flv.git
该名堂袭取c言语和Qt成就,本文作家凭证旨趣袭取Java进行了翻写,仅供学习和参考。若是要用于骨子运用,请使用原名堂提供的器用,不错将qsv文献诊治为flv或mp4局势。
gpt文爱到此这篇对于Java杀青索要QSV文献视频内容的著述就先容到这了麻豆 视频,更多相干Java索要QSV文献视频内容内容请搜索剧本之家往常的著述或继续浏览底下的相干著述但愿公共以后多多因循剧本之家!
您可能感好奇景仰好奇景仰的著述: Java文献批量重定名批量索要特定类型文献 java读取word文档,索要标题和内容的实例 Java使用正则抒发式索要XML节点内容的要害示例 javaCV视频处理之索要东谈主像视频 java使用ffmpeg杀青上传视频的转码索要视频的截图等功能(代码操作)