Live transcoding and streaming of MP4 works in Android but fails in Flash player with NetStream.Play.FileStructureInvalid error

前端 未结 1 1181
深忆病人
深忆病人 2021-01-06 15:06

Recently I had a task to use ffmpeg as a transcoding as well a streaming tool. The task was to convert the file from a given format to MP4 and immediately stream it, by capt

相关标签:
1条回答
  • 2021-01-06 15:52

    As noted in the docs for -movflags

    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 the end of the file, it can be moved to the start for better playback using the qt-faststart tool). A fragmented file consists of a number of fragments, where packets and metadata about these packets are stored together. Writing a fragmented file has the advantage that the file is decodable even if the writing is interrupted (while a normal MOV/MP4 is undecodable if it is not properly finished), and it requires less memory when writing very long files (since writing normal MOV/MP4 files stores info about every single packet in memory until the file is closed). The downside is that it is less compatible with other applications.

    Either switch to a flash player that can handle fragmented MP4 files, or use a different container format that supports streaming better.

    Also, -re is an input-only option, so it would make more sense to specify it before the input, instead of before the output.

    0 讨论(0)
提交回复
热议问题