php - Retrieve specific chunk file from MongoDB gridfs -
i have stored 1.5gb video file mongodb gridfs using php script chunk size 15mb.
i can retrieve full video file using filename. wanted skip chunk files , retrieve specific part of video.
is possible skip , retrieve specific chunk files?
thanks, hari.
although requirement sounds simple @ glance, believe implementation more involved looks, since if understand correctly, want build video streaming system.
gridfs not have knowledge of content of storing. convention enable store documents larger 16 mb in mongodb (larger maximum bson size).
gridfs achieves splitting input file "chunks", application make sense of data in chunks.
if require specific part of video retrieving specific chunk range, need consider things:
- videos compressed using variable rate encoding (vbr), means 1 15 mb chunk contain varying minutes of video (e.g. 15 minutes in 1 chunk, 12 minutes in chunk, etc.).
- video files contain metadata part (e.g. title, synopsis, etc.). need recognize metadata part , separate them actual video packets. of time, metadata size different video packet size.
- how granular "seeking" want. e.g., if require 1-second seek granularity, need calculate how data contained in 1-second video. calculated easier if using constant bitrate encoding (cbr).
hence, achieve require, need to:
- encode video using constant bitrate (cbr).
- be able dissect video format able store 1 video packet in 1 chunk exactly.
- store video metadata somewhere else.
basically, means need construct player can understand storage scheme able "seek" point in video reliably.
Comments
Post a Comment