Skip to content

Instantly share code, notes, and snippets.

View AllanChen's full-sized avatar

AllanChan AllanChen

View GitHub Profile
#!/bin/sh
git filter-branch --env-filter '
OLD_EMAIL="[email protected]"
CORRECT_NAME="www"
CORRECT_EMAIL="[email protected]"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
@AllanChen
AllanChen / WMFVideoReadWrite.cpp
Created February 19, 2022 07:48 — forked from m1keall1son/WMFVideoReadWrite.cpp
C++ Program to read a video file and re-encode it to H.264 / AAC using Windows Media Foundation
//USAGE $ program.exe path\\to\\video-in.mp4 path\\to\\video-out.mp4
#include <iostream>
#include <string>
#include <mfidl.h> // Media Foundation interfaces
#include <mfapi.h> // Media Foundation platform APIs
#include <mferror.h> // Media Foundation error codes
#include <mfreadwrite.h>
#include <wmcontainer.h> // ASF-specific components
//OpenCV Convert YUV buffer to rgb mat
Mat y(actual_size, CV_8UC1);
Mat u(half_size, CV_8UC1);
Mat v(half_size, CV_8UC1);
//
memcpy(y.data, frame_buffer->DataY(), actual_size.width * actual_size.height);
memcpy(u.data, frame_buffer->DataU(), half_size.width * half_size.height);
memcpy(v.data, frame_buffer->DataV(), half_size.width * half_size.height);
//