久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

    <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="qwawimqqmiuu" 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 在后臺轉換視頻

      How to convert video in the background using PHP and ffmpeg(如何使用 PHP 和 ffmpeg 在后臺轉換視頻)
        <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="qwawimqqmiuu" 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 在后臺轉換視頻的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                我允許用戶上傳視頻,然后使用 ffmpeg 進行轉換.視頻轉換需要很長時間,這通常會導致錯誤.我已經完成了我的研究,但不知道應該從哪里開始.

                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.

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

                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.

                我怎樣才能做到這一點?

                How can I accomplish this?

                推薦答案

                以下是如何使用 Cron 等調度系統創建自己的隊列的基本概要:

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

                • 創建一個包含(id, created_at, file_path, id_user, result, error)的數據庫表queue.file_path 包含要處理的上傳視頻的位置,處理前結果為null,然后根據成功情況為true/false,以及如果失敗 error 包含任何消息.如果合適,用戶表的主鍵也可以保存在這里.
                • 每分鐘運行一個 Cron 程序來檢查隊列中是否有任何未處理的項目.
                • 如果有項目在等待,請遍歷其中的一些項目并運行您的視頻轉換代碼.您可能希望將其限制為一次處理不超過五個項目,并且任何更多排隊的項目都必須等待新的 cron 運行.
                • 在您的 cron 腳本開始時,如果舊副本已經在運行,您需要提前退出.您可以使用 ps aux | 的輸出.如果您在類似 *nix 的操作系統中運行,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 應用程序中,您需要稍微修改工作流程 - 而不是期望立即處理視頻,您需要:

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

                • 通過創建新的數據庫行請求視頻轉換
                • 重定向到說明正在創建視頻的頁面
                • 使用網絡重定向、AJAX 或網絡套接字定期重新檢查轉換狀態.

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

                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.

                這篇關于如何使用 PHP 和 ffmpeg 在后臺轉換視頻的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

                相關文檔推薦

                MySQLi prepared statement amp; foreach loop(MySQLi準備好的語句amp;foreach 循環)
                Is mysqli_insert_id() gets record from whole server or from same user?(mysqli_insert_id() 是從整個服務器還是從同一用戶獲取記錄?)
                PHP MySQLi doesn#39;t recognize login info(PHP MySQLi 無法識別登錄信息)
                mysqli_select_db() expects exactly 2 parameters(mysqli_select_db() 需要 2 個參數)
                Php mysql pdo query: fill up variable with query result(Php mysql pdo 查詢:用查詢結果填充變量)
                MySQLI 28000/1045 Access denied for user #39;root#39;@#39;localhost#39;(MySQLI 28000/1045 用戶“root@“localhost的訪問被拒絕)
              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="qwawimqqmiuu" 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'>

                          主站蜘蛛池模板: 久久免费看| 国产日韩欧美 | 色综合99| 超碰天天 | 国内精品久久久久久 | 精品国产乱码久久久久久中文 | 成人免费视频网站在线看 | 天天综合网天天综合 | 欧美专区在线视频 | 久久精品亚洲欧美日韩久久 | 国产精品jizz在线观看老狼 | 欧美日韩电影一区二区 | 亚洲国产精品久久 | 国产成人精品一区二区在线 | 久久国产日韩欧美 | 欧美性video 精品亚洲一区二区 | 超级乱淫av片免费播放 | 在线看av网址 | 色爱综合网| 婷婷中文在线 | 国产精品69久久久久水密桃 | 日韩精品一区二区三区四区视频 | 瑞克和莫蒂第五季在线观看 | 欧美一区二区免费在线 | 操久久 | 九九精品视频在线 | 国产美女精品视频 | 成人高清视频在线观看 | 日韩中文字幕一区 | 中文视频在线 | 久久久精彩视频 | 日本不卡一区 | 国产三级精品视频 | 日韩精品免费视频 | 欧美激情精品久久久久久 | 在线看免费 | 国产亚洲一区二区三区在线 | 成人毛片在线观看 | 久久精品国产99国产精品 | 亚州精品天堂中文字幕 | 影音先锋中文字幕在线观看 |