How to detect if a video file was recorded in portrait orientation, or landscape in iOS

Based on the previous answer, you can use the following to determine the video orientation: + (UIInterfaceOrientation)orientationForTrack:(AVAsset *)asset { AVAssetTrack *videoTrack = [[asset tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0]; CGSize size = [videoTrack naturalSize]; CGAffineTransform txf = [videoTrack preferredTransform]; if (size.width == txf.tx && size.height == txf.ty) return UIInterfaceOrientationLandscapeRight; else if (txf.tx == 0 && txf.ty == 0) return … Read more

Extracting DCT coefficients from encoded images and video

Well, I did a bit of reading and my original question seems to be an instance of wishful thinking. Basically, it’s not possible to get the DCT coefficients from H.264 video frames for the simple reason that H.264 doesn’t use DCT. It uses a different transform (integer transform). Next, the coefficients for that transform don’t … Read more

Solid FFmpeg wrapper for C#/.NET

This is a wrapper of my own: https://github.com/AydinAdn/MediaToolkit MediaToolkit can: Convert video files into various other video formats. Perform video transcoding tasks. Options configurable: Bit rate, Frame rate, Resolution / size, Aspect ratio, Duration of video Perform audio transcoding tasks. Options configurable: Audio sample rate Convert video to physical formats using FILM, PAL or NTSC … Read more

Rotating videos with FFmpeg

Rotate 90 clockwise: ffmpeg -i in.mov -vf “transpose=1” out.mov For the transpose parameter you can pass: 0 = 90CounterCLockwise and Vertical Flip (default) 1 = 90Clockwise 2 = 90CounterClockwise 3 = 90Clockwise and Vertical Flip Use -vf “transpose=2,transpose=2” for 180 degrees. Make sure you use a recent ffmpeg version from here (a static build will … Read more

Vertically or horizontally stack (mosaic) several videos using ffmpeg? [closed]

Use the vstack (vertical), hstack (horizontal), or xstack (custom layout) filters. It is easier and faster than other methods. Combine/stack two videos or images Vertical Using the vstack filter. ffmpeg -i input0 -i input1 -filter_complex vstack=inputs=2 output Videos must have the same width. Horizontal Using the hstack filter. ffmpeg -i input0 -i input1 -filter_complex hstack=inputs=2 … Read more