AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / computer / 问题 / 1507460
Accepted
Surprisejedi
Surprisejedi
Asked: 2019-12-05 12:04:15 +0800 CST2019-12-05 12:04:15 +0800 CST 2019-12-05 12:04:15 +0800 CST

我可以使用 FFmpeg 对文件进行转码并即时读取输出文件吗?

  • 772

我有一个 .M3U8 流,我可以下载它并使用 FFmpeg 进行转换: ffmpeg -protocol_whitelist file,http,https,tcp,tls -i "org_file.m3u8" -c copy -bsf:a aac_adtstoasc output.mp4 但是在转码时我无法打开 output.mp4 文件。

ffmpeg streaming
  • 2 2 个回答
  • 4091 Views

2 个回答

  • Voted
  1. Best Answer
    slhck
    2019-12-05T12:11:17+08:002019-12-05T12:11:17+08:00

    常规 MP4 文件在转码时无法播放,因为一旦编码完成,MOOV atom(解析文件所必需的)会在最后写入。在许多情况下,它会被移动到文件的开头——就是-movflags +faststart这样——但你仍然必须等待文件被写入一次。

    碎片化 MP4 (fMP4) 文件是一种特殊的 MP4 文件,可以在写入时读取,请参阅此答案。用于-movflags +frag_keyframe+separate_moof+omit_tfhd_offset+empty_moov启用分片。

    只要写入了足够多的数据,MPEG-2 传输流文件就可以在写入的同时播放。您可以尝试将数据写入.ts文件,然后等待几秒钟,然后开始播放。

    如果你想实时写入数据,你必须添加 global 选项-re,这使得 ffmpeg 实时读取输入,因此写入速度不会比你可以播放的速度快。

    • 5
  2. SebMa
    2022-01-18T07:42:20+08:002022-01-18T07:42:20+08:00

    使用 ISMV 格式 ( -f ismv) 似乎会自动选择正确的-movflags选项,以便在编码时能够读取输出文件:

    $ ffmpeg .... -f ismv output.mp4
    $ man ffmpeg-formats | grep ismv -B5
               Set the sample rate for libopenmpt to output.  Range is from 1000 to INT_MAX. The value default is 48000.
    
       mov/mp4/3gp
           Demuxer for Quicktime File Format & ISO/IEC Base Media File Format (ISO/IEC 14496-12 or MPEG-4 Part 12, ISO/IEC 15444-12 or JPEG 2000 Part 12).
    
           Registered extensions: mov, mp4, m4a, 3gp, 3g2, mj2, psp, m4b, ism, ismv, isma, f4v
    --
    
                   ffmpeg -i INPUT -f md5 -
    
           See also the hash and framemd5 muxers.
    
       mov, mp4, ismv
           MOV/MP4/ISMV (Smooth Streaming) muxer.
    
           The mov/mp4/ismv muxer supports fragmentation. Normally, a MOV/MP4 file has all the metadata about all packets stored in one location (written at
    --
           -movflags empty_moov
               Write an initial moov atom directly at the start of the file, without describing any samples in it. Generally, an mdat/moov pair is written at
               the start of the file, as a normal MOV/MP4 file, containing only a short portion of the file. With this option set, there is no initial mdat
               atom, and the moov atom only describes the tracks but has a zero duration.
    
               This option is implicitly set when writing ismv (Smooth Streaming) files.
    
           -movflags separate_moof
               Write a separate moof (movie fragment) atom for each track. Normally, packets for all tracks are written in a moof atom (which is slightly more
               efficient), but with this option set, the muxer writes one moof/mdat pair for each track, making it easier to separate tracks.
    
               This option is implicitly set when writing ismv (Smooth Streaming) files.
    --
           -movflags negative_cts_offsets
               Enables utilization of version 1 of the CTTS box, in which the CTS offsets can be negative. This enables the initial sample to have DTS/CTS of
               zero, and reduces the need for edit lists for some cases such as video tracks with B-frames. Additionally, eases conformance with the DASH-IF
               interoperability guidelines.
    
               This option is implicitly set when writing ismv (Smooth Streaming) files.
    --
    
           Example
    
           Smooth Streaming content can be pushed in real time to a publishing point on IIS with this muxer. Example:
    
    • 2

相关问题

  • -map_metadata 抓取多个音频流元数据

  • 最低比特率 ffmpeg 输出的编解码器和设置

  • 如何用ffmpeg 2.0.2保存TS视频流?

  • 快速提取 I 帧到图像

  • 压缩视频可以解码回未压缩的原始格式吗?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    Windows 照片查看器因为内存不足而无法运行?

    • 5 个回答
  • Marko Smith

    支持结束后如何激活 WindowsXP?

    • 6 个回答
  • Marko Smith

    远程桌面间歇性冻结

    • 7 个回答
  • Marko Smith

    Windows 10 服务称为 AarSvc_70f961。它是什么,我该如何禁用它?

    • 2 个回答
  • Marko Smith

    子网掩码 /32 是什么意思?

    • 6 个回答
  • Marko Smith

    鼠标指针在 Windows 中按下的箭头键上移动?

    • 1 个回答
  • Marko Smith

    VirtualBox 无法以 VERR_NEM_VM_CREATE_FAILED 启动

    • 8 个回答
  • Marko Smith

    应用程序不会出现在 MacBook 的摄像头和麦克风隐私设置中

    • 5 个回答
  • Marko Smith

    ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] 证书验证失败:无法获取本地颁发者证书 (_ssl.c:1056)

    • 4 个回答
  • Marko Smith

    我如何知道 Windows 安装在哪个驱动器上?

    • 6 个回答
  • Martin Hope
    Albin 支持结束后如何激活 WindowsXP? 2019-11-18 03:50:17 +0800 CST
  • Martin Hope
    fixer1234 “HTTPS Everywhere”仍然相关吗? 2019-10-27 18:06:25 +0800 CST
  • Martin Hope
    Kagaratsch Windows 10 删除大量小文件的速度非常慢。有什么办法可以加快速度吗? 2019-09-23 06:05:43 +0800 CST
  • Martin Hope
    andre_ss6 远程桌面间歇性冻结 2019-09-11 12:56:40 +0800 CST
  • Martin Hope
    Riley Carney 为什么在 URL 后面加一个点会删除登录信息? 2019-08-06 10:59:24 +0800 CST
  • Martin Hope
    zdimension 鼠标指针在 Windows 中按下的箭头键上移动? 2019-08-04 06:39:57 +0800 CST
  • Martin Hope
    Inter Sys Ctrl+C 和 Ctrl+V 是如何工作的? 2019-05-15 02:51:21 +0800 CST
  • Martin Hope
    jonsca 我所有的 Firefox 附加组件突然被禁用了,我该如何重新启用它们? 2019-05-04 17:58:52 +0800 CST
  • Martin Hope
    MCK 是否可以使用文本创建二维码? 2019-04-02 06:32:14 +0800 CST
  • Martin Hope
    SoniEx2 更改 git init 默认分支名称 2019-04-01 06:16:56 +0800 CST

热门标签

windows-10 linux windows microsoft-excel networking ubuntu worksheet-function bash command-line hard-drive

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve