|
|
Operations with ffmpeg
|
|
|
|
|
|
# convert AVI to MKV
|
|
|
|
|
|
You need the flags `-fflags +genpts` to create the timings that are missing in the .avi.
|
|
|
|
|
|
Example:
|
|
|
|
|
|
```
|
|
|
ffmpeg -fflags +genpts -i input.ts -c copy output.mkv
|
|
|
```
|
|
|
|
|
|
See https://stackoverflow.com/questions/66013483/cant-write-packet-with-unknown-timestamp-av-interleaved-write-frame-invalid.
|
|
|
|
|
|
# add subtitles to a video
|
|
|
|
|
|
You can just add the subtitles to the video file. For this, multiple versions exist:
|
|
|
|
|
|
```
|
|
|
ffmpeg -i input.mkv -i input.srt -map 0 -map 1 -c copy output.mkv
|
|
|
```
|
|
|
|
|
|
or
|
|
|
|
|
|
```
|
|
|
ffmpeg -i input.mkv -i input.srt -c copy output.mkv
|
|
|
```
|
|
|
|
|
|
If you want to further describe the metadata for the subtitles you have to specify it after the subtitle:
|
|
|
|
|
|
```
|
|
|
ffmpeg -i input.mkv -i input.srt -c copy -metadata:s:s:0 language=eng -metadata:s:s:0 handler_name=English -metadata:s:s:0 title=English output.mkv
|
|
|
```
|
|
|
|
|
|
# concat videos
|
|
|
|
|
|
For the concat mode you need to have the filenames in a file. This file should look like
|
|
|
|
|
|
```
|
|
|
file /path/to/video1.mkv
|
|
|
file /path/to/video2.mkv
|
|
|
```
|
|
|
|
|
|
To ignore spaces in the file names you further have to add the argument `-safe 0` before the `-i`.
|
|
|
|
|
|
Example:
|
|
|
|
|
|
```
|
|
|
ffmpeg -f concat -safe 0 -i filelist.lst -c copy output.mkv
|
|
|
```
|
|
|
|
|
|
If you further need subtitles you have to copy them, too. For this, just add the options `-scodec copy` to the line above:
|
|
|
|
|
|
```
|
|
|
ffmpeg -f concat -safe 0 -i filelist.lst -c copy -scodec copy output.mkv
|
|
|
```
|
|
|
|
|
|
See https://stackoverflow.com/questions/27671646/use-ffmpeg-to-join-mp4-files-while-preserving-subtitles-stream. |