On the ffmpeg to mobile phone video to find the long-width of the video fell the problem

Source: Internet
Author: User

1. Overview

Recently with the code to mobile phone video, found a very strange phenomenon, obviously the source video object is vertical, turn the wrong, find a half-day to find is not cared for the video stream rotate value. Take a note.

2. Solutions

We can read the rotate value through Av_dict_get in the input stream and write this value to the output stream.

The code is as follows:

	if (InputStream)
		{
			Avdictionaryentry *tag = NULL;  
			Tag = Av_dict_get (Inputstream->metadata, "rotate", tag, 0);

			if (tag! = NULL)  
			{
				av_dict_set (&poutstream->metadata, "rotate", tag->value, 0);}
		}

Where: InputStream is the AVSTREAM structure pointer, is the input video stream. Poutstream is the input video stream.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.