FFmpeg – Overlay one video onto another video?

If you just want a ffmpeg command, try ffmpeg -i input.mov -i overlay.mov \ -filter_complex “[1:v]setpts=PTS-10/TB[a]; \ [0:v][a]overlay=enable=gte(t\,5):shortest=1[out]” \ -map [out] -map 0:a \ -c:v libx264 -crf 18 -pix_fmt yuv420p \ -c:a copy \ output.mov This starts the overlay at 5 seconds with the overlaid video start point being 00:15. setpts=PTS-10/TB is setpts=PTS+(overlay_delay-video_trim_in)/TB overlay=enable=gte(t\,5) is … Read more

Is there a way to use ffmpeg to determine the encoding of a file before transcoding?

Use ffprobe Example command $ ffprobe -v error -select_streams v:0 -show_entries stream=codec_name -of default=nokey=1:noprint_wrappers=1 input.mp4 Result h264 Option descriptions -v error Omit extra information except for fatal errors. -select_streams v:0 Select only the first video stream. Otherwise the codec_name for all other streams in the file, such as audio, will be shown as well. -show_entries … 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

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

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

Post processing in ffmpeg to move ‘moov atom’ in MP4 files (qt-faststart)

Seems like faststart support has been included in ffmpeg. FFmpeg Formats Documentation: -movflags faststart Run a second pass moving the moov atom on top of the file. This operation can take a while, and will not work in various situations such as fragmented output, thus it is not enabled by default.