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

Getting green screen in ffplay: Streaming desktop (DirectX surface) as H264 video over RTP stream using Live555

It’s harder than it seems. If you want to use the encoder as you’re doing, by calling IMFTransform interface directly, you have to convert RGB frames to NV12. If you want good performance, you should do it on GPU. Possible to do with pixel shaders, render 2 frames, full size one into DXGI_FORMAT_R8_UNORM render target … Read more

How to add album art with ffmpeg?

With Recent version, ffmpeg -i in.mp3 -i test.png -map 0:0 -map 1:0 -c copy -id3v2_version 3 -metadata:s:v title=”Album cover” -metadata:s:v comment=”Cover (front)” out.mp3 Use -map to associate input stream to the output Use -c copy to directly demux/remux The -id3v2_version 3 is what is missing in your command line. Note that that wil write an … Read more

FFmpeg: How to split video efficiently?

The ffmpeg wiki links back to this page in reference to “How to split video efficiently”. I’m not convinced this page answers that question, so I did as @AlcubierreDrive suggested… echo “Two commands” time ffmpeg -v quiet -y -i input.ts -vcodec copy -acodec copy -ss 00:00:00 -t 00:30:00 -sn test1.mkv time ffmpeg -v quiet -y … Read more

How to control key-frame generation of ffmpeg?

It is possible for ffmpeg to generate Key frame at irregular interval, based on scene change detection. key frame interval can be controlled by GOP size. the following options can be used -g (FFmpeg) Keyframe interval, also known as GOP length. This determines the maximum distance between I-frames. Very high GOP lengths will result in … 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

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