2022-01-25 20:21:47 +01:00
|
|
|
ks-mp4 - Convert video file to compact and efficient MP4.
|
|
|
|
=========================================================
|
2021-03-07 20:10:48 +01:00
|
|
|
|
2021-03-22 18:43:19 +01:00
|
|
|
### Syntax:
|
2021-03-07 20:10:48 +01:00
|
|
|
|
2021-04-18 00:21:59 +02:00
|
|
|
```shell
|
|
|
|
$ ks-mp4 </absolute/path/video.mkv> </path/prefix_name>
|
|
|
|
```
|
2021-03-07 20:10:48 +01:00
|
|
|
|
|
|
|
### Default configuration:
|
|
|
|
|
|
|
|
* The script `ks-mp4` use by default the following configuration:
|
2021-04-18 00:21:59 +02:00
|
|
|
|
|
|
|
```shell
|
|
|
|
- Resolution: 1280x534
|
|
|
|
- Video codec: libx264
|
2023-03-19 12:32:55 +01:00
|
|
|
- Bitrate video: 2200k
|
|
|
|
- Preset: slow
|
2021-04-18 00:21:59 +02:00
|
|
|
- Audio codec: aac (stereo)
|
2023-03-19 12:32:55 +01:00
|
|
|
- Bitrate audio: 192k
|
2021-04-18 00:21:59 +02:00
|
|
|
- Default Audio: spa
|
|
|
|
- Default Subtitle: spa (forced)
|
|
|
|
- Container: mp4
|
|
|
|
````
|
2021-03-07 20:10:48 +01:00
|
|
|
|
2022-01-02 12:25:43 +01:00
|
|
|
* If you want to change the settings, you need to edit the `~/.ks-tools/ks-mp4` file and change the following variables:
|
2021-04-18 00:21:59 +02:00
|
|
|
|
|
|
|
```shell
|
|
|
|
rel_size="1280x534"
|
|
|
|
vcodec="libx264"
|
2023-03-19 12:32:55 +01:00
|
|
|
b_vcodec="2200k"
|
|
|
|
v_preset="slow"
|
2021-04-18 00:21:59 +02:00
|
|
|
acodec="aac"
|
2023-03-19 12:32:55 +01:00
|
|
|
b_acodec="192k"
|
2021-04-18 00:21:59 +02:00
|
|
|
default_lang_audio="spa"
|
|
|
|
default_lang_subt="spa"
|
|
|
|
v_ext="mp4"
|
|
|
|
````
|
2022-01-02 16:47:57 +01:00
|
|
|
|
2022-10-12 13:17:48 +02:00
|
|
|
* RECOMMENDED: You can use the [ks-conf](https://gitlab.com/q3aql/ks-tools/blob/main/doc/ks-conf.md) tool to edit the configuration.
|
2022-01-02 16:47:57 +01:00
|
|
|
|
2021-03-07 20:10:48 +01:00
|
|
|
### Example of use:
|
|
|
|
|
|
|
|
* An example of use would be the following:
|
|
|
|
|
2021-04-18 00:21:59 +02:00
|
|
|
```shell
|
|
|
|
$ ks-mp4 /data/movies/Example.mkv /data/converted/Example
|
|
|
|
````
|
2021-03-07 20:10:48 +01:00
|
|
|
|
|
|
|
* Executing the command, the file will be analyzed and a wizard will be shown to select the tracks, choose the settings and define the metadata:
|
2021-04-18 00:21:59 +02:00
|
|
|
|
|
|
|
```shell
|
|
|
|
* Information of Example.mkv:
|
|
|
|
|
|
|
|
+ Video Tracks:
|
|
|
|
Stream #0:0: Video: h264 (High)
|
|
|
|
|
|
|
|
+ Audio Tracks:
|
|
|
|
Stream #0:1(spa): Audio: ac3
|
|
|
|
Stream #0:2(eng): Audio: ac3
|
|
|
|
|
|
|
|
+ Subtitle Tracks:
|
|
|
|
Stream #0:3(spa): Subtitle: subrip (default) (forced)
|
|
|
|
Stream #0:4(spa): Subtitle: hdmv_pgs_subtitle
|
|
|
|
Stream #0:5(spa): Subtitle: subrip (forced)
|
|
|
|
Stream #0:6(eng): Subtitle: subrip
|
|
|
|
|
|
|
|
* (Default: 0:0) Type the number of video track:
|
|
|
|
* (Default: 0:1) Type the number of audio track:
|
|
|
|
* (Default: n) Do you want include subtitles? (y/n): y
|
|
|
|
* (Default: 0:3) Type the number of subtitle track: 0:5
|
|
|
|
* (Default: 1280x534) Type the resolution:
|
|
|
|
* (Default: n) Do you want apply '-max_muxing_queue_size 9999' patch? (y/n): n
|
|
|
|
|
|
|
|
* METADATA configuration:
|
|
|
|
|
|
|
|
* (Default: Example) Type name of title:
|
|
|
|
* (Default: 2021) Type the year: 2016
|
|
|
|
* (Default: Unknown) Type the genre: Thriller
|
|
|
|
|
|
|
|
* COMMANDS THAT WILL BE EXECUTED:
|
|
|
|
|
|
|
|
# Extract subtitles from file Example.mkv
|
|
|
|
ffmpeg -i "Example.mkv" -map 0:5 "Example.srt"
|
|
|
|
|
|
|
|
# Convert the file 'Example.mkv' to MP4
|
2023-02-10 18:48:25 +01:00
|
|
|
ffmpeg -i "Example.mkv" -fps_mode cfr -af aresample=async=1 -map 0:0 -map 0:1
|
|
|
|
-vf subtitles="Example.srt" -s 1280x534 -c:v libx264 -profile:v high
|
2022-01-18 21:25:57 +01:00
|
|
|
-b:v 2400k -preset medium -c:a aac -b:a 256k -ac 2 -clev 3dB -slev -6dB
|
|
|
|
-metadata title="Example (2016)" -metadata date="2016" -metadata genre="Thriller"
|
|
|
|
-metadata:s:v:0 title="Example (2016)"
|
2021-04-18 00:21:59 +02:00
|
|
|
-metadata:s:a:0 title="aac Stereo Audio (256k)" "Example.mp4"
|
2021-03-07 20:10:48 +01:00
|
|
|
|
2021-04-18 00:21:59 +02:00
|
|
|
* (Default: y) Do you want run the conversion? (y/n): n
|
|
|
|
````
|
2021-03-07 20:10:48 +01:00
|
|
|
|
|
|
|
### Back to README.md
|
|
|
|
|
2022-03-26 14:53:14 +01:00
|
|
|
* [Go back](../README.md)
|
2021-03-22 18:43:19 +01:00
|
|
|
|