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

ffmpeg video to opengl texture

Is the texture initialized when you call glTexSubImage2D? You need to call glTexImage2D (not Sub) one time to initialize the texture object. Use NULL for the data pointer, OpenGL will then initialize a texture without copying data. answered EDIT You’re not supplying mipmaping levels. So did you disable mipmaping? glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILER, linear_interpolation ? GL_LINEAR : … Read more

Unable to do low-level decoding of video on Android 4.2 without using media extractor

try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); FileInputStream fis = new FileInputStream(new File( “ur file path”)); byte[] buf = new byte[1024]; int n; while (-1 != (n = fis.read(buf))) { baos.write(buf, 0, n); } byte[] videoBytes = baos.toByteArray(); // use this videoBytes which is low level of original video } catch (Exception e) { e.printStackTrace(); … 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

Maintaining aspect ratio with FFmpeg

-vf “scale=640:-1” works great until you will encounter error [libx264 @ 0x2f08120] height not divisible by 2 (640×853) So most generic approach is use filter expressions: scale=640:trunc(ow/a/2)*2 It takes output width (ow), divides it by aspect ratio (a), divides by 2, truncates digits after decimal point and multiplies by 2. It guarantees that resulting height … Read more

Reducing video size with same format and reducing frame size

ffmpeg provides this functionality. All you need to do is run someting like ffmpeg -i <inputfilename> -s 640×480 -b 512k -vcodec mpeg1video -acodec copy <outputfilename> For newer versions of ffmpeg you need to change -b to -b:v: ffmpeg -i <inputfilename> -s 640×480 -b:v 512k -vcodec mpeg1video -acodec copy <outputfilename> to convert the input video file … 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