当前位置:网站首页>Optimization of MP4 file missing seconds caused by TS files when downloading videos from easydss video platform
Optimization of MP4 file missing seconds caused by TS files when downloading videos from easydss video platform
2022-06-24 12:43:00 【Tsingsee green rhino video】
EasyDSS The video platform supports video downloading , A copy of the downloaded video file will be kept ts file , At the same time mp4 The format of is saved in the video folder . Under some custom projects ,EasyDSS After downloading the video of MP4 File missing seconds . Although we have dealt with similar problems before , But the reasons for this problem are different .
The problem is actually related to the video file ts Related documents , When the system downloads mp4 When you file , The backend first queries the corresponding ts file , And because the EasyDSS The query for is not complete , Only then causes the user to download MP4 The file is incomplete .
To solve such problems , We change the logic of the system to synthesize according to the downloaded parameters m3u8 file , Use it again m3u8 File transfer mp4 file , The reference codes are as follows :
// Generate m3u8 //m3u8TS, err := r.getRecordM3U8File(id, start, end, videoID, true) _,fileRealPath_m3u8, err:=service.GeneterateRecordM3u8(id,starttime, endtime,true) if err != nil { AbortWithString(c, http.StatusBadRequest, " Generate M3U8 error ") return } //m3u8 turn MP4 //mp4_name := id+"_"+starttime+"_"+starttime+".mp4" filePath_mp4 := trans.M3U8ToMP4_TimeName(fileRealPath_m3u8,mp4Path) if filePath_mp4 == "" { AbortWithString(c, http.StatusBadRequest, "M3U8 turn MP4 Failure ") return } r.operFile(c, operate, filePath_mp4, videoID) efile.RemoveFile(fileRealPath_m3u8)
The composite will be deleted finally m3u8 file ,mp4 Regular file cleaning , The code to free unnecessary disk space is as follows :
After the solution, the complete can be downloaded successfully mp4 file :
边栏推荐
- mLife Forum | 微生物组和数据挖掘
- Embedded must learn! Detailed explanation of hardware resource interface - based on arm am335x development board (Part 1)
- 《回归故里》阅读笔记
- 105. simple chat room 8: use socket to transfer pictures
- WPF from zero to 1 tutorial details, suitable for novices on the road
- Sms service sms
- 【数据库】期末复习(计科版)
- OpenGL es shared context for multi-threaded rendering
- 105. 简易聊天室8:使用 Socket 传递图片
- The opportunity to teach cloud development a lesson has finally come!
猜你喜欢
使用开源工具 k8tz 优雅设置 Kubernetes Pod 时区
《回归故里》阅读笔记
一文讲透植物内生菌研究怎么做 | 微生物专题
【数据挖掘】期末复习(样卷题目+少量知识点)
文本转语音功能上线,可以体验专业播音员的服务,诚邀试用
Use the open source tool k8tz to gracefully set the kubernetes pod time zone
[mysql_16] variables, process control and cursors
WPF从零到1教程详解,适合新手上路
Reading notes of returning to hometown
Opencv learning notes - regions of interest (ROI) and image blending
随机推荐
OpenGL es shared context for multi-threaded rendering
About me, a 19 line programmer
[log service CLS] Tencent cloud log service CLS accesses CDN
Jenkins pipeline syntax
Istio FAQ: istio init crash
Essential key steps in the construction of e-commerce live broadcast source code
As one of the bat, what open source projects does Tencent have?
Dingding, Feishu, and enterprise wechat: different business approaches
A "full cloud" journey of a quasi financial system
Codereview tool chain for micro medicine
The latest hot spot: the use of copper death related genes for tumor prognosis typing!
Listed JD Logistics: breaking through again
Speculation London gold short-term stable money making skills? Where is it safe to fry London gold?
Reset the password, and the automatic login of the website saved by chrome Google browser is lost. What is the underlying reason?
Istio practical skills: using prism to construct multi version test services
Sms service sms
Use the object selection tool to quickly create a selection in Adobe Photoshop
Ghost, a synonym for blog system
A scheme for crawlers to collect public opinion data
Continuous testing | making testing more free: practicing automated execution of use cases in coding