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

Use ffmpeg to add text subtitles [closed]

NOTE: This solution adds the subtitles to the video as a separate optional (and user-controlled) subtitle track. ffmpeg -i infile.mp4 -i infile.srt -c copy -c:s mov_text outfile.mp4 -vf subtitles=infile.srt will not work with -c copy The order of -c copy -c:s mov_text is important. You are telling FFmpeg: Video: copy, Audio: copy, Subtitle: copy Subtitle: … Read more

FFMPEG: get last 10 seconds [closed]

Use the -sseof input option. From the documentation: -sseof position (input) Like the -ss option but relative to the “end of file”. That is negative values are earlier in the file, 0 is at EOF. Example: ffmpeg -sseof -10 -i input.mp4 output.mp4 Note that in stream copy mode (by using the -c copy output option … Read more

adding silent audio in ffmpeg

anullsrc audio filter You can use ffmpeg to create the silent audio and combine it with a video in one step. This example will use the anullsrc audio filter to generate stereo silent audio with a sample rate of 44100: ffmpeg -f lavfi -i anullsrc=channel_layout=stereo:sample_rate=44100 -i video.mov -c:v copy -c:a aac -shortest output.mov channel_layout=stereo:sample_rate=44100 is … Read more

Using ffmpeg to change framerate

With re-encoding: ffmpeg -y -i seeing_noaudio.mp4 -vf “setpts=1.25*PTS” -r 24 seeing.mp4 Without re-encoding: First step – extract video to raw bitstream ffmpeg -y -i seeing_noaudio.mp4 -c copy -f h264 seeing_noaudio.h264 Remux with new framerate ffmpeg -y -r 24 -i seeing_noaudio.h264 -c copy seeing.mp4

How to install and run phpize

For recent versions of Debian/Ubuntu (Debian 9+ or Ubuntu 16.04+) install the php-dev dependency package, which will automatically install the correct version of php{x}-dev for your distribution: sudo apt install php-dev Older versions of Debian/Ubuntu: For PHP 5, it’s in the php5-dev package. sudo apt-get install php5-dev For PHP 7.x (from rahilwazir comment): sudo apt-get … Read more

Text on video ffmpeg

Use the drawtext filter for simple text on video. If you need more complex timing, formatting, or dynamic text see the subtitles filter. This answer focuses on the drawtext filter. Example Print Stack Overflow in white text onto center of video, with black background box of 50% opacity: ffmpeg -i input.mp4 -vf “drawtext=fontfile=/path/to/font.ttf:text=”Stack Overflow”:fontcolor=white:fontsize=24:box=1:boxcolor=black@0.5:boxborderw=5:x=(w-text_w)/2:y=(h-text_h)/2″ -codec:a … Read more

tech