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

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

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

How to convert RGB from YUV420p for ffmpeg encoder?

You can use libswscale from FFmpeg like this: #include <libswscale/swscale.h> SwsContext * ctx = sws_getContext(imgWidth, imgHeight, AV_PIX_FMT_RGB24, imgWidth, imgHeight, AV_PIX_FMT_YUV420P, 0, 0, 0, 0); uint8_t * inData[1] = { rgb24Data }; // RGB24 have one plane int inLinesize[1] = { 3*imgWidth }; // RGB stride sws_scale(ctx, inData, inLinesize, 0, imgHeight, dst_picture.data, dst_picture.linesize); Note that you … Read more

How to resize a picture using ffmpeg’s sws_scale()?

First you need to create a SwsContext (you need to do this only once) : struct SwsContext *resize; resize = sws_getContext(width1, height1, AV_PIX_FMT_YUV420P, width2, height2, PIX_FMT_RGB24, SWS_BICUBIC, NULL, NULL, NULL); You need two frames for conversion, frame1 is the original frame, you need to explicitly allocate frame2 : AVFrame* frame1 = avcodec_alloc_frame(); // this 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