Mp4文件修复
///
//date: 2019.10.25
//修复行车记录仪等视频文件
//支持因异常掉电等原因导致的损坏
//支持mp4或3gp等视频文件
//支持H264, H265等编码格式(亲测有效)
//支持Android, Linux, Windows(全部验证通过)
//QQ: 515311445
///
#include "mp4.h"
#include "atom.h"
#include <iostream>
#include <string>
using namespace std;
int main(int argc, char *argv[]) {
bool info = false;
bool analyze = false;
string ok = "ok.mp4";
string corrupt = "corrupted.mp4";;
Mp4 mp4;
try {
mp4.open(ok);
if(info) {
mp4.printMediaInfo();
mp4.printAtoms();
}
if(analyze) {
mp4.analyze();
}
if(corrupt.size()) {
mp4.repair(corrupt);
mp4.saveVideo(corrupt + "_fixed.mp4");
}
}
catch (char const* e) {
cerr << e << endl;
return -1;
}
return 0;
}
文档来源:51CTO技术博客https://blog.51cto.com/u_15298588/3034155
页:
[1]