Category:Video: Difference between revisions
(→FFMpeg) |
|||
| (23 intermediate revisions by the same user not shown) | |||
| Line 14: | Line 14: | ||
</pre> | </pre> | ||
First command generates the convolution file, second command applies it. | First command generates the convolution file, second command applies it. | ||
== Remove | == Remove Subtitles == | ||
<pre> | <pre> | ||
ffmpeg -i series_launch_english.mp4 -c copy -sn series_launch_english_nosubs.mp4 | ffmpeg -i series_launch_english.mp4 -c copy -sn series_launch_english_nosubs.mp4 | ||
| Line 20: | Line 20: | ||
See Also: https://start.duckduckgo.com/?q=Advanced+SubStation+Alpha&ia=web | See Also: https://start.duckduckgo.com/?q=Advanced+SubStation+Alpha&ia=web | ||
= | = FFMpeg = | ||
== | == Concat == | ||
<pre> | <pre> | ||
cat > list.txt | |||
file 'file1.mkv' | |||
file 'file2.mkv' | |||
^d | |||
ffmpeg -f concat -safe 0 -i list.txt -map 0 -c copy output.mkv | |||
</pre> | </pre> | ||
or | |||
<pre> | <pre> | ||
ffmpeg -f concat -safe 0 -i list.txt \ | |||
-map 0:v -map 0:a -map 0:s -map 1:v -map 1:a -map 1:s \ | |||
-c copy output.mkv | |||
</pre> | </pre> | ||
== Resize == | |||
== | === Scale, Match Vertical to Suit 720 === | ||
<pre> | <pre> | ||
ffmpeg -i input.avi -filter:v scale=720:-1 -c:a copy output.mkv | |||
</pre> | </pre> | ||
== Time == | |||
<pre> | <pre> | ||
ffmpeg -i | ffmpeg -i foo.avi -ss 01:23:45 -to 02:34:56 out.avi | ||
</pre> | </pre> | ||
= Players = | |||
== MPV == | |||
Prefer French audio: | |||
<pre> | <pre> | ||
$ mpv ./Futurama-S0[123]*mkv --alang=fr,fre,en --loop-playlist | |||
</pre> | </pre> | ||
Use two sets of subtitles: | |||
<pre> | <pre> | ||
$ mpv kaamelott_book_1_volume_2.webm --sid=1 --secondary-sid=2 | |||
</pre> | </pre> | ||
Specify a subtitle file and run two sets of subtitles: | |||
<pre> | <pre> | ||
$ mpv kaamelott_book_1_volume_1.webm --sub-file=kaamelott_book_1_volume_1.en-GB.vtt --sid=1 --secondary-sid=2 | |||
</pre> | </pre> | ||
= Subtitle Processing = | |||
== Embed .vtt into .mkv == | |||
<pre> | <pre> | ||
ffmpeg -i | ffmpeg -i input.mkv -i subtitles.vtt -c:v copy -c:a copy -c:s mov_text -map 0 -map 1 -metadata:s:s:0 language=fre output.mkv | ||
</pre> | </pre> | ||
<pre> | <pre> | ||
ffmpeg -i subtitles.vtt subtitles.srt | |||
ffmpeg -i input.mkv -i subtitles.srt -c:v copy -c:a copy -c:s srt -map 0 -map 1 -metadata:s:s:0 language=fre output.mkv | |||
</pre> | </pre> | ||
== Dual Subtitles == | |||
=== Option 1: Use <code>secondary-sid</code> === | |||
mpv has a <code>secondary-sid</code> option, which lets you specify a second subtitle track to render alongside the primary one. | |||
For example: | |||
Where: | |||
* <code>--sid=1</code> → the main subtitle track (e.g., English) | |||
* <code>--secondary-sid=2</code> → the secondary subtitle track (e.g., French) | |||
You can check the track IDs by running: | |||
or just <code>mpv video.mkv</code> and press <code>j</code> to cycle through tracks and note their IDs. | |||
---- | |||
< | === Option 2: External subtitle files === | ||
If you have separate <code>.srt</code> or <code>.vtt</code> files for English and French: | |||
</ | |||
You can also use <code>.vtt</code> files this way. | |||
---- | |||
=== Option 3: Config file === | |||
If you often want this behavior, add to your <code>~/.config/mpv/mpv.conf</code>: | |||
You may need to adjust the numbers (<code>sid</code>) to match your preferred language tracks. | |||
= | === More Options === | ||
You are correct: in '''mpv 0.35.1''', there is support for <code>--secondary-sid</code> (to select a second subtitle ''track'' already present in the media), but there is '''no option called <code>--secondary-sub-file</code>'''. | |||
=== | |||
= | |||
This is because mpv’s “secondary subtitle” system only applies to ''subtitle streams already loaded'', either from the container or from a single external subtitle file loaded as primary. | This is because mpv’s “secondary subtitle” system only applies to ''subtitle streams already loaded'', either from the container or from a single external subtitle file loaded as primary. | ||
Latest revision as of 13:12, 14 October 2025
Quick Tips
Cinemagoer Extract
imdbpy search movie "12 Monkeys" python ../../util/test.py 0114746 > 12_Monkeys.json
Image Stabilization
FFMPEG
ffmpeg -i input.mp4 -vf vidstabdetect=shakiness=10:accuracy=15 -f null - ffmpeg -i input.mp4 -vf vidstabtransform=smoothing=30:zoom=0 output.mp4
First command generates the convolution file, second command applies it.
Remove Subtitles
ffmpeg -i series_launch_english.mp4 -c copy -sn series_launch_english_nosubs.mp4
See Also: https://start.duckduckgo.com/?q=Advanced+SubStation+Alpha&ia=web
FFMpeg
Concat
cat > list.txt file 'file1.mkv' file 'file2.mkv' ^d ffmpeg -f concat -safe 0 -i list.txt -map 0 -c copy output.mkv
or
ffmpeg -f concat -safe 0 -i list.txt \ -map 0:v -map 0:a -map 0:s -map 1:v -map 1:a -map 1:s \ -c copy output.mkv
Resize
Scale, Match Vertical to Suit 720
ffmpeg -i input.avi -filter:v scale=720:-1 -c:a copy output.mkv
Time
ffmpeg -i foo.avi -ss 01:23:45 -to 02:34:56 out.avi
Players
MPV
Prefer French audio:
$ mpv ./Futurama-S0[123]*mkv --alang=fr,fre,en --loop-playlist
Use two sets of subtitles:
$ mpv kaamelott_book_1_volume_2.webm --sid=1 --secondary-sid=2
Specify a subtitle file and run two sets of subtitles:
$ mpv kaamelott_book_1_volume_1.webm --sub-file=kaamelott_book_1_volume_1.en-GB.vtt --sid=1 --secondary-sid=2
Subtitle Processing
Embed .vtt into .mkv
ffmpeg -i input.mkv -i subtitles.vtt -c:v copy -c:a copy -c:s mov_text -map 0 -map 1 -metadata:s:s:0 language=fre output.mkv
ffmpeg -i subtitles.vtt subtitles.srt ffmpeg -i input.mkv -i subtitles.srt -c:v copy -c:a copy -c:s srt -map 0 -map 1 -metadata:s:s:0 language=fre output.mkv
Dual Subtitles
Option 1: Use secondary-sid
mpv has a secondary-sid option, which lets you specify a second subtitle track to render alongside the primary one.
For example:
Where:
--sid=1→ the main subtitle track (e.g., English)--secondary-sid=2→ the secondary subtitle track (e.g., French)
You can check the track IDs by running:
or just mpv video.mkv and press j to cycle through tracks and note their IDs.
Option 2: External subtitle files
If you have separate .srt or .vtt files for English and French:
You can also use .vtt files this way.
Option 3: Config file
If you often want this behavior, add to your ~/.config/mpv/mpv.conf:
You may need to adjust the numbers (sid) to match your preferred language tracks.
More Options
You are correct: in mpv 0.35.1, there is support for --secondary-sid (to select a second subtitle track already present in the media), but there is no option called --secondary-sub-file.
This is because mpv’s “secondary subtitle” system only applies to subtitle streams already loaded, either from the container or from a single external subtitle file loaded as primary.
What works:
If your video already contains both English and French subtitle tracks:
You can enable them both like this:
This renders both subtitle tracks simultaneously. They will stack in the same position unless you adjust one of them with options like sub-pos or sub-margin-y.
If you have two separate external subtitle files (.srt or .vtt):
By default, mpv will only load one external subtitle file, even if you specify multiple --sub-file arguments — it ignores the rest.
Workarounds:
- Mux both subtitle files into the video container (e.g.,
.mkv) Usemkvmerge:
- This displays both lines in one cue.
- Use an mpv Lua script to load two external subtitle files. There are community Lua scripts that let you load and display two external subtitles, one at the top and one at the bottom. See the mpv Lua script resources page: https://mpv.io/resources/
Summary:
--secondary-sub-fileis not implemented.--secondary-sidworks, but only with embedded tracks.- For external files: either mux them into the video file, combine them manually, or use a Lua script.
If you’d like, I can help you:
- Write a shell script to mux
.srtfiles into.mkvautomatically. - Write a minimal Lua script to load and render two
.srtfiles in mpv.
- Then you can use
--sidand--secondary-sidas above. - Manually combine them into one subtitle file. Example:
Voice Acting
- 10 Voice Tones: https://old.reddit.com/r/TikTokCringe/comments/1at3n7a/voiceover_actor_explains10_tones_used_during_reads/
- "im an audio for video engineer, im the person directly communicating with the voice actor to make sure the producer is happy during recording, and it really is wild the amount of times they give what is a really over the top read from their point of view, and we have to prop then up to get them to go even bigger and more exaggerated. It feels unnatural, and bizarre, but it plays well in a VO"
- "It's like that for stage plays and performances. a persons delivery really flattens out the farther it travels so you gotta make it over-the-top"
- "im an audio for video engineer, im the person directly communicating with the voice actor to make sure the producer is happy during recording, and it really is wild the amount of times they give what is a really over the top read from their point of view, and we have to prop then up to get them to go even bigger and more exaggerated. It feels unnatural, and bizarre, but it plays well in a VO"