pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

    <i id='SYiae'><tr id='SYiae'><dt id='SYiae'><q id='SYiae'><span id='SYiae'><b id='SYiae'><form id='SYiae'><ins id='SYiae'></ins><ul id='SYiae'></ul><sub id='SYiae'></sub></form><legend id='SYiae'></legend><bdo id='SYiae'><pre id='SYiae'><center id='SYiae'></center></pre></bdo></b><th id='SYiae'></th></span></q></dt></tr></i><div class="rrhrfzp" id='SYiae'><tfoot id='SYiae'></tfoot><dl id='SYiae'><fieldset id='SYiae'></fieldset></dl></div>
      <bdo id='SYiae'></bdo><ul id='SYiae'></ul>
  1. <tfoot id='SYiae'></tfoot>

    <legend id='SYiae'><style id='SYiae'><dir id='SYiae'><q id='SYiae'></q></dir></style></legend>

      <small id='SYiae'></small><noframes id='SYiae'>

    1. 如何使用 PHP 和 ffmpeg 在后臺(tái)轉(zhuǎn)換視頻

      How to convert video in the background using PHP and ffmpeg(如何使用 PHP 和 ffmpeg 在后臺(tái)轉(zhuǎn)換視頻)
        <bdo id='GjtGm'></bdo><ul id='GjtGm'></ul>
        <legend id='GjtGm'><style id='GjtGm'><dir id='GjtGm'><q id='GjtGm'></q></dir></style></legend>

            • <tfoot id='GjtGm'></tfoot>
            • <i id='GjtGm'><tr id='GjtGm'><dt id='GjtGm'><q id='GjtGm'><span id='GjtGm'><b id='GjtGm'><form id='GjtGm'><ins id='GjtGm'></ins><ul id='GjtGm'></ul><sub id='GjtGm'></sub></form><legend id='GjtGm'></legend><bdo id='GjtGm'><pre id='GjtGm'><center id='GjtGm'></center></pre></bdo></b><th id='GjtGm'></th></span></q></dt></tr></i><div class="yuients" id='GjtGm'><tfoot id='GjtGm'></tfoot><dl id='GjtGm'><fieldset id='GjtGm'></fieldset></dl></div>
                  <tbody id='GjtGm'></tbody>

                <small id='GjtGm'></small><noframes id='GjtGm'>

                本文介紹了如何使用 PHP 和 ffmpeg 在后臺(tái)轉(zhuǎn)換視頻的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                問題描述

                我允許用戶上傳視頻,然后使用 ffmpeg 進(jìn)行轉(zhuǎn)換.視頻轉(zhuǎn)換需要很長(zhǎng)時(shí)間,這通常會(huì)導(dǎo)致錯(cuò)誤.我已經(jīng)完成了我的研究,但不知道應(yīng)該從哪里開始.

                I allow users to upload videos and then they get converted using ffmpeg. The video takes a really long time to convert which usually results in an error. I have done my research with no luck as to where I should get started.

                基本上我想要做的是允許用戶上傳視頻,然后顯示一條消息,表示正在處理視頻,您將在可用時(shí)收到通知.同時(shí),我希望視頻在幕后進(jìn)行轉(zhuǎn)換,并允許用戶離開頁面甚至關(guān)閉瀏覽器.我使用的是 Windows 服務(wù)器.

                Basically what I want to do is allow the user to upload the video and then display a message that says video is being processed and you will be notified when available. In the meantime I want the video to be converted behind the scenes and allow the user to leave the page or even close the browser. I am using a Windows server.

                我怎樣才能做到這一點(diǎn)?

                How can I accomplish this?

                推薦答案

                以下是如何使用 Cron 等調(diào)度系統(tǒng)創(chuàng)建自己的隊(duì)列的基本概要:

                Here is a basic run-down of how to make your own queue using a scheduling system such as Cron:

                • 創(chuàng)建一個(gè)包含(id, created_at, file_path, id_user, result, error)的數(shù)據(jù)庫表queue.file_path 包含要處理的上傳視頻的位置,處理前結(jié)果為null,然后根據(jù)成功情況為true/false,以及如果失敗 error 包含任何消息.如果合適,用戶表的主鍵也可以保存在這里.
                • 每分鐘運(yùn)行一個(gè) Cron 程序來檢查隊(duì)列中是否有任何未處理的項(xiàng)目.
                • 如果有項(xiàng)目在等待,請(qǐng)遍歷其中的一些項(xiàng)目并運(yùn)行您的視頻轉(zhuǎn)換代碼.您可能希望將其限制為一次處理不超過五個(gè)項(xiàng)目,并且任何更多排隊(duì)的項(xiàng)目都必須等待新的 cron 運(yùn)行.
                • 在您的 cron 腳本開始時(shí),如果舊副本已經(jīng)在運(yùn)行,您需要提前退出.您可以使用 ps aux | 的輸出.如果您在類似 *nix 的操作系統(tǒng)中運(yùn)行,grep (scriptname) 可以提供幫助.
                • Create a database table queue containing (id, created_at, file_path, id_user, result, error). The file_path contains the location of the uploaded video to process, the result is null before processing and then true/false afterwards depending on success, and if it failed error contains any messages. The primary key of the user table can be saved here too, if appropriate.
                • Every minute, run a Cron program to check the queue for any unprocessed items.
                • If there are items waiting, loop through a few of them and run your video conversion code. You may wish to limit this so that no more than, say, five items are processed in one go, and any more queued items have to wait for a new cron run.
                • At the start of your cron script you need to exit early if an old copy is already running. You can use the output of ps aux | grep (scriptname) to help here, if you are running in a *nix-like operating system.

                在您的 Web 應(yīng)用程序中,您需要稍微修改工作流程 - 而不是期望立即處理視頻,您需要:

                Inside your web application, you need to somewhat modify the workflow - rather than expecting a video to be processed immediately, you need to:

                • 通過創(chuàng)建新的數(shù)據(jù)庫行請(qǐng)求視頻轉(zhuǎn)換
                • 重定向到說明正在創(chuàng)建視頻的頁面
                • 使用網(wǎng)絡(luò)重定向、AJAX 或網(wǎng)絡(luò)套接字定期重新檢查轉(zhuǎn)換狀態(tài).

                這種方法對(duì)于無法安裝自己的隊(duì)列處理器的共享主機(jī)非常有用.但是,如果您使用的是 VPS 或云系統(tǒng),您可能希望查看 Gearman 或許多其他排隊(duì)系統(tǒng)之一.它們比上面的要復(fù)雜一些,但具有更多用于管理工作隊(duì)列的功能.

                This approach is very useful for shared hosting where you cannot install your own queue processors. However, if you are on a VPS or cloud system, you may wish to look into Gearman or one of many other queueing systems. They are a bit more complex than the above, but have more features for managing queues of work.

                這篇關(guān)于如何使用 PHP 和 ffmpeg 在后臺(tái)轉(zhuǎn)換視頻的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

                相關(guān)文檔推薦

                MySQLi prepared statement amp; foreach loop(MySQLi準(zhǔn)備好的語句amp;foreach 循環(huán))
                Is mysqli_insert_id() gets record from whole server or from same user?(mysqli_insert_id() 是從整個(gè)服務(wù)器還是從同一用戶獲取記錄?)
                PHP MySQLi doesn#39;t recognize login info(PHP MySQLi 無法識(shí)別登錄信息)
                mysqli_select_db() expects exactly 2 parameters(mysqli_select_db() 需要 2 個(gè)參數(shù))
                Php mysql pdo query: fill up variable with query result(Php mysql pdo 查詢:用查詢結(jié)果填充變量)
                MySQLI 28000/1045 Access denied for user #39;root#39;@#39;localhost#39;(MySQLI 28000/1045 用戶“root@“l(fā)ocalhost的訪問被拒絕)
              1. <legend id='RRNSq'><style id='RRNSq'><dir id='RRNSq'><q id='RRNSq'></q></dir></style></legend>
                  <tbody id='RRNSq'></tbody>
              2. <i id='RRNSq'><tr id='RRNSq'><dt id='RRNSq'><q id='RRNSq'><span id='RRNSq'><b id='RRNSq'><form id='RRNSq'><ins id='RRNSq'></ins><ul id='RRNSq'></ul><sub id='RRNSq'></sub></form><legend id='RRNSq'></legend><bdo id='RRNSq'><pre id='RRNSq'><center id='RRNSq'></center></pre></bdo></b><th id='RRNSq'></th></span></q></dt></tr></i><div class="ix33t3c" id='RRNSq'><tfoot id='RRNSq'></tfoot><dl id='RRNSq'><fieldset id='RRNSq'></fieldset></dl></div>
                  <bdo id='RRNSq'></bdo><ul id='RRNSq'></ul>
                    <tfoot id='RRNSq'></tfoot>

                          <small id='RRNSq'></small><noframes id='RRNSq'>

                          主站蜘蛛池模板: PE一体化污水处理设备_地埋式生活污水净化槽定制厂家-岩康塑业 | 【甲方装饰】合肥工装公司-合肥装修设计公司,专业从事安徽办公室、店面、售楼部、餐饮店、厂房装修设计服务 | ASA膜,ASA共挤料,篷布色母料-青岛未来化学有限公司 | 国产液相色谱仪-超高效液相色谱仪厂家-上海伍丰科学仪器有限公司 | PE一体化污水处理设备_地埋式生活污水净化槽定制厂家-岩康塑业 | PSI渗透压仪,TPS酸度计,美国CHAI PCR仪,渗透压仪厂家_价格,微生物快速检测仪-华泰和合(北京)商贸有限公司 | 百度爱采购运营研究社社群-店铺托管-爱采购代运营-良言多米网络公司 | 一体化隔油提升设备-餐饮油水分离器-餐厨垃圾处理设备-隔油池-盐城金球环保产业发展有限公司 | 新材料分散-高速均质搅拌机-超声波分散混合-上海化烁智能设备有限公司 | 即用型透析袋,透析袋夹子,药敏纸片,L型涂布棒-上海桥星贸易有限公司 | 河北凯普威医疗器材有限公司,高档轮椅系列,推车系列,座厕椅系列,协步椅系列,拐扙系列,卫浴系列 | 集装袋吨袋生产厂家-噸袋廠傢-塑料编织袋-纸塑复合袋-二手吨袋-太空袋-曹县建烨包装 | 土壤有机碳消解器-石油|表层油类分析采水器-青岛溯源环保设备有限公司 | 塑胶地板-商用PVC地板-pvc地板革-安耐宝pvc塑胶地板厂家 | 磁力抛光机_磁力研磨机_磁力去毛刺机_精密五金零件抛光设备厂家-冠古科技 | 刘秘书_你身边专业的工作范文写作小秘书 | 阀门智能定位器_电液动执行器_气动执行机构-赫尔法流体技术(北京)有限公司 | 全自动过滤器_反冲洗过滤器_自清洗过滤器_量子除垢环_量子环除垢_量子除垢 - 安士睿(北京)过滤设备有限公司 | 国际船舶网 - 船厂、船舶、造船、船舶设备、航运及海洋工程等相关行业综合信息平台 | 茅茅虫AI论文写作助手-免费AIGC论文查重_写毕业论文降重 | 中空玻璃生产线,玻璃加工设备,全自动封胶线,铝条折弯机,双组份打胶机,丁基胶/卧式/立式全自动涂布机,玻璃设备-山东昌盛数控设备有限公司 | 济宁工业提升门|济宁电动防火门|济宁快速堆积门-济宁市统一电动门有限公司 | 北京燃气公司 用户服务中心| 老城街小面官网_正宗重庆小面加盟技术培训_特色面馆加盟|牛肉拉面|招商加盟代理费用多少钱 | 沈阳缠绕膜价格_沈阳拉伸膜厂家_沈阳缠绕膜厂家直销 | 警方提醒:赣州约炮论坛真的安全吗?2025年新手必看的网络交友防坑指南 | 茶叶百科网-茶叶知识与茶文化探讨分享平台 | 全国国际化学校_国际高中招生_一站式升学择校服务-国际学校网 | 水上浮桥-游艇码头-浮动码头-游船码头-码瑞纳游艇码头工程 | 生态板-实木生态板-生态板厂家-源木原作生态板品牌-深圳市方舟木业有限公司 | 冰雕-冰雪世界-大型冰雕展制作公司-赛北冰雕官网 | 食安观察网| 自动售货机_无人售货机_专业的自动售货机运营商_免费投放售货机-广州富宏主官网 | 硬齿面减速机_厂家-山东安吉富传动设备股份有限公司 | 硫化罐-胶管硫化罐-山东鑫泰鑫智能装备有限公司 | PO膜_灌浆膜及地膜供应厂家 - 青州市鲁谊塑料厂 | 开锐教育-学历提升-职称评定-职业资格培训-积分入户 | 寮步纸箱厂_东莞纸箱厂 _东莞纸箱加工厂-东莞市寮步恒辉纸制品厂 | 河南中整光饰机械有限公司-抛光机,去毛刺抛光机,精密镜面抛光机,全自动抛光机械设备 | 刘秘书_你身边专业的工作范文写作小秘书 | 光环国际-新三板公司_股票代码:838504 |