FFmpeg

Maybe I can handle every media with ffmpeg...

Usage

Cut Video

ffmpeg -ss 00:00:07.2 -to 00:00:12 -i input.mov output.mp4

Some people will have problems with the black frames at the beginning/end of the procedure video, the parameter -c copy may be the trouble-maker. the following reason may help you fix the problem.

When specifying -c copy, ffmpeg will cut the video without modifying the actual bitstream. In other words, it will take the frames as-is and copy them to the output file. In some cases (simply put, when the starting time does not correspond to an I-frame), ffmpeg needs to include some more frames that are needed to properly decode the first frame to be displayed. Those will get a negative timestamp, so they shouldn't be shown.

Reference: Black frames at beginning of video file when file cut

Video to GIF

ffmpeg -i output.mp4 -vf "fps=10,scale=320:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 output.gif

I simply use the answer from google, and this works well, no in-depth research.

Reference: How do I convert a video to GIF using ffmpeg, with reasonable quality?

Combine Multiple M3U8 Files into a Single File

For combining multiple M3U8 files into a single AAC audio file, you can use the following FFmpeg command:

ffmpeg -i example.m3u8 -c copy output.aac

This command copies the audio codec from the input M3U8 files without encoding, resulting in a consolidated AAC file named output.aac.

Last updated