how to store a bits stream as video format?

2 ビュー (過去 30 日間)
tiburce sotohou
tiburce sotohou 2015 年 11 月 18 日
回答済み: tiburce sotohou 2015 年 11 月 19 日
hello! I need help for matlab function to store a bits stream that I get from another function. thanks

回答 (3 件)

Dinesh Iyer
Dinesh Iyer 2015 年 11 月 18 日
Try fwrite(). Just write the bytes stream to a file. fwrite does not care what the bytes represent.

Walter Roberson
Walter Roberson 2015 年 11 月 18 日
I knew this Question was coming as soon as I read your Question about how to convert a video to a bit stream. My answer at that time was
vidcontent = fileread('YourVideoFile.avi');
bitstream = reshape(dec2bin(vidcontent,8).', [], 1) - '0';
The reverse of that is
bytestream = uint8(bin2dec(reshape(char(bitstream + '0'), 8, [])));
and now you can use fopen / fwrite / fclose to write the stream to a file.
Note that this is the general process to transfer any file as a stream of bits. And usually when people ask specifically about transferring video what they really want is a video streaming mechanism, especially one for wireless or radio that is robust to data corruption and can survive dropped data, to play the video on a device rather than to store the data. What we have shown here is not a video streaming mechanism, it is a "convert bytes to bits" mechanism.

tiburce sotohou
tiburce sotohou 2015 年 11 月 19 日
Thanks. I'll try that and give you feedback

カテゴリ

Help Center および File ExchangeSignal Processing についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by