<i id='kabQE'><tr id='kabQE'><dt id='kabQE'><q id='kabQE'><span id='kabQE'><b id='kabQE'><form id='kabQE'><ins id='kabQE'></ins><ul id='kabQE'></ul><sub id='kabQE'></sub></form><legend id='kabQE'></legend><bdo id='kabQE'><pre id='kabQE'><center id='kabQE'></center></pre></bdo></b><th id='kabQE'></th></span></q></dt></tr></i><div id='kabQE'><tfoot id='kabQE'></tfoot><dl id='kabQE'><fieldset id='kabQE'></fieldset></dl></div>

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

        <bdo id='kabQE'></bdo><ul id='kabQE'></ul>

    1. <tfoot id='kabQE'></tfoot>
      <legend id='kabQE'><style id='kabQE'><dir id='kabQE'><q id='kabQE'></q></dir></style></legend>

      1. FFmpeg 可以连接来自不同域的文件吗?

        时间:2023-09-20
          <tbody id='kREmF'></tbody>
        • <tfoot id='kREmF'></tfoot>
            <bdo id='kREmF'></bdo><ul id='kREmF'></ul>
            <legend id='kREmF'><style id='kREmF'><dir id='kREmF'><q id='kREmF'></q></dir></style></legend>

                <i id='kREmF'><tr id='kREmF'><dt id='kREmF'><q id='kREmF'><span id='kREmF'><b id='kREmF'><form id='kREmF'><ins id='kREmF'></ins><ul id='kREmF'></ul><sub id='kREmF'></sub></form><legend id='kREmF'></legend><bdo id='kREmF'><pre id='kREmF'><center id='kREmF'></center></pre></bdo></b><th id='kREmF'></th></span></q></dt></tr></i><div id='kREmF'><tfoot id='kREmF'></tfoot><dl id='kREmF'><fieldset id='kREmF'></fieldset></dl></div>

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

                1. 本文介绍了FFmpeg 可以连接来自不同域的文件吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在尝试将各种 .ts 视频剪辑连接成一个视频,然后将视频转换为 .mp4 文件.我知道我可以制作一个格式如下的 .txt 文件:

                  I'm attempting to concatenate various .ts video clips into one video and then convert the video into an .mp4 file. I know I can make a .txt file formatted like so:

                  file '/path/to/file1'
                  file '/path/to/file2'
                  file '/path/to/file3'
                  

                  然后像这样连接它们:

                  ffmpeg -f concat -i mylist.txt -c copy all.ts
                  

                  然后像这样转换文件:

                  ffmpeg -i all.ts -acodec copy -vcodec copy all.mp4
                  

                  我的问题是,我的 .txt 文件可以是来自另一个域的网址吗?例如:

                  My question is, can my .txt file be urls from another domain? e.g.:

                  http://somewebsite.com/files/videoclip1.ts
                  http://somewebsite.com/files/videoclip2.ts
                  http://somewebsite.com/files/videoclip3.ts
                  

                  或者,我是否必须先下载所有这些剪辑,将它们本地存储在我的域中,然后制作一个指向它们的 .txt 文件?我正在使用 PHP.谢谢.

                  Or, do I first have to download all these clips, store them locally on my domain, then make a .txt file pointing to them? I'm using PHP. Thanks.

                  推荐答案

                  是的,这是可能的.请注意,在以下示例中,我使用了您问题中的 url 和文件名,测试时我在自己的网络服务器上使用了一些测试文件.

                  Yes, this is possible. Note that in the following examples I use the urls and filenames from your question, when testing I used some test files on my own web server.

                  使用您提供的示例文本文件尝试此操作将给出非常明确的错误消息:

                  Trying this with the example text file you provided will give a pretty clear error message:

                  [concat @ 0x7f892f800000] 第 1 行:未知关键字 'http://somewebsite.com/files/videoclip1.ts

                  [concat @ 0x7f892f800000] Line 1: unknown keyword 'http://somewebsite.com/files/videoclip1.ts

                  mylist.txt:处理输入时发现无效数据

                  mylist.txt: Invalid data found when processing input

                  通过在 mylist.txt 中重新引入 'file' 关键字很容易解决这个问题:

                  This is easily fixed by re-introducing the 'file' keyword in mylist.txt:

                  file 'http://somewebsite.com/files/videoclip1.ts'
                  file 'http://somewebsite.com/files/videoclip2.ts'
                  file 'http://somewebsite.com/files/videoclip3.ts'
                  

                  更新后的文件会给出不同的错误信息:

                  That updated file will give a different error message:

                  [concat @ 0x7fa467800000] 不安全的文件名 'http://somewebsite.com/files/videoclip1.ts'

                  [concat @ 0x7fa467800000] Unsafe file name 'http://somewebsite.com/files/videoclip1.ts'

                  mylist.txt:不允许操作

                  mylist.txt: Operation not permitted

                  这样做的原因是ffmpeg默认不允许http-urls.这可以通过在 ffmpeg 调用中包含 -safe 0 参数before -i 参数来绕过:

                  The reason for this is that ffmpeg will not allow http-urls by default. This can be bypassed by including the -safe 0 argument in your ffmpeg call before the -i argument:

                  ffmpeg -f concat -safe 0 -i mylist.txt -c copy all.ts
                  

                  这可能在您的安装中开箱即用,在我的安装中,这给出了另一条错误消息:

                  This might work out of the box on your installation, on mine this gave another error message:

                  [http @ 0x7faa68507940] 协议 'http' 不在白名单 'file,crypto' 中!

                  [http @ 0x7faa68507940] Protocol 'http' not on whitelist 'file,crypto'!

                  [concat @ 0x7faa69001200] 无法打开 'http://somewebsite.com/files/videoclip1.ts'

                  [concat @ 0x7faa69001200] Impossible to open 'http://somewebsite.com/files/videoclip1.ts'

                  mylist.txt:无效参数

                  mylist.txt: Invalid argument

                  这是因为,在我的安装中,ffmpeg 的默认协议白名单仅包括 filecrypto.为了也允许 http 协议,我们需要在命令中明确提供允许的协议白名单.事实证明,tcp 也是必需的:

                  This is because, on my installation, ffmpeg's default protocol whitelist only includes file and crypto. To allow the http protocol as well, we need to explicitly provide the allowed protocols whitelist in the command. As it turns out, tcp is also required:

                  ffmpeg -f concat -safe 0 -protocol_whitelist file,http,tcp -i mylist.txt -c copy all.ts
                  

                  这允许我的安装下载和连接视频文件.

                  This allowed my installation to download and concatenate the video files.

                  这篇关于FFmpeg 可以连接来自不同域的文件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:在php中使用ffmpeg为视频添加水印 下一篇:为文本文件生成缩略图

                  相关文章

                  最新文章

                2. <legend id='Ls5o6'><style id='Ls5o6'><dir id='Ls5o6'><q id='Ls5o6'></q></dir></style></legend>
                        <bdo id='Ls5o6'></bdo><ul id='Ls5o6'></ul>
                      <i id='Ls5o6'><tr id='Ls5o6'><dt id='Ls5o6'><q id='Ls5o6'><span id='Ls5o6'><b id='Ls5o6'><form id='Ls5o6'><ins id='Ls5o6'></ins><ul id='Ls5o6'></ul><sub id='Ls5o6'></sub></form><legend id='Ls5o6'></legend><bdo id='Ls5o6'><pre id='Ls5o6'><center id='Ls5o6'></center></pre></bdo></b><th id='Ls5o6'></th></span></q></dt></tr></i><div id='Ls5o6'><tfoot id='Ls5o6'></tfoot><dl id='Ls5o6'><fieldset id='Ls5o6'></fieldset></dl></div>

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

                    1. <tfoot id='Ls5o6'></tfoot>