ffmpeg 获取和设置视频旋转角度


        AVDictionaryEntry *tag = NULL;
	tag = av_dict_get(m_pVideoStream->metadata, "rotate", tag, 0);
	if (tag == NULL)
	{
		m_Rotate = MT_VIDEO_ROTATE_0;
	}
	else
	{
		int angle = atoi(tag->value);
		angle %= 360;
		if (angle == 90)
		{
			m_Rotate = MT_VIDEO_ROTATE_90;
		}
		else if (angle == 180)
		{
			m_Rotate = MT_VIDEO_ROTATE_180;
		}
		else if (angle == 270)
		{
			m_Rotate = MT_VIDEO_ROTATE_270;
		}
		else
		{
			m_Rotate = MT_VIDEO_ROTATE_0;
		}
	}


设置旋转角度

ret = av_dict_set(&m_pDstVideoStream->metadata,"rotate","90",0);


open之前设置

//
class CStudent
{
public:
	CStudent(const char* pInputName,int id)
	{
		int nLen = strlen(pInputName);
		m_pName = new char[nLen + 1];
		strcpy(m_pName,pInputName);
		m_ID = id;
	}
	~CStudent()
	{
		delete [] m_pName;
	}
	void SetID(int id)
	{
		m_ID = id;
	}
	int GetID()
	{
		return m_ID;
	}
private:
	char* m_pName;
	int m_ID;
};

int main()
{
	CStudent A("Joy",10001);
	CStudent B("Lily",10002);

	//Swap ID
	CStudent nTempC = A;
	A.SetID(B.GetID());
	B.SetID(nTempC.GetID());

	return 0;
}


你可能感兴趣的:(ffmpeg 获取和设置视频旋转角度)