<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://freemwiki.com/index.php?action=history&amp;feed=atom&amp;title=Openai%2F6957d2e8-b738-8008-987a-09a5d9f29bc8</id>
	<title>Openai/6957d2e8-b738-8008-987a-09a5d9f29bc8 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://freemwiki.com/index.php?action=history&amp;feed=atom&amp;title=Openai%2F6957d2e8-b738-8008-987a-09a5d9f29bc8"/>
	<link rel="alternate" type="text/html" href="https://freemwiki.com/index.php?title=Openai/6957d2e8-b738-8008-987a-09a5d9f29bc8&amp;action=history"/>
	<updated>2026-04-25T21:06:32Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.3</generator>
	<entry>
		<id>https://freemwiki.com/index.php?title=Openai/6957d2e8-b738-8008-987a-09a5d9f29bc8&amp;diff=595177&amp;oldid=prev</id>
		<title>Lukegao: by freem.ai...</title>
		<link rel="alternate" type="text/html" href="https://freemwiki.com/index.php?title=Openai/6957d2e8-b738-8008-987a-09a5d9f29bc8&amp;diff=595177&amp;oldid=prev"/>
		<updated>2026-01-03T05:28:00Z</updated>

		<summary type="html">&lt;p&gt;by freem.ai...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&lt;br /&gt;
{{DISPLAYTITLE:FFmpeg video cut guide}}&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;This conversation was exported from ChatGPT&amp;#039;&amp;#039;&amp;lt;ref&amp;gt;{{cite web|title=FFmpeg video cut guide|url=https://chatgpt.com/share/6957d2e8-b738-8008-987a-09a5d9f29bc8|publisher=ChatGPT|access-date=2026-01-02}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== gpt-5-2-thinking ==&lt;br /&gt;
=== User: ffmpeg cut from video the timestamsp 01:02 - 02:13 + 03:17 - 05:26 + 09:21 - 09:28 + 09:44 - 10:04 into a single video ===&lt;br /&gt;
ffmpeg cut from video the timestamsp 01:02 - 02:13 + 03:17 - 05:26 + 09:21 - 09:28 + 09:44 - 10:04 into a single video&lt;br /&gt;
&lt;br /&gt;
=== Assistant: Here are two good ways to do it. ===&lt;br /&gt;
Here are two good ways to do it.&lt;br /&gt;
&lt;br /&gt;
==== This will cut exactly at those timestamps and stitch into one file. ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;ffmpeg -i input.mp4 -filter_complex \&lt;br /&gt;
&amp;quot;[0:v]trim=start=62:end=133,setpts=PTS-STARTPTS[v0]; \&lt;br /&gt;
 [0:a]atrim=start=62:end=133,asetpts=PTS-STARTPTS[a0]; \&lt;br /&gt;
 [0:v]trim=start=197:end=326,setpts=PTS-STARTPTS[v1]; \&lt;br /&gt;
 [0:a]atrim=start=197:end=326,asetpts=PTS-STARTPTS[a1]; \&lt;br /&gt;
 [0:v]trim=start=561:end=568,setpts=PTS-STARTPTS[v2]; \&lt;br /&gt;
 [0:a]atrim=start=561:end=568,asetpts=PTS-STARTPTS[a2]; \&lt;br /&gt;
 [0:v]trim=start=584:end=604,setpts=PTS-STARTPTS[v3]; \&lt;br /&gt;
 [0:a]atrim=start=584:end=604,asetpts=PTS-STARTPTS[a3]; \&lt;br /&gt;
 [v0][a0][v1][a1][v2][a2][v3][a3]concat=n=4:v=1:a=1[v][a]&amp;quot; \&lt;br /&gt;
-map &amp;quot;[v]&amp;quot; -map &amp;quot;[a]&amp;quot; \&lt;br /&gt;
-c:v libx264 -crf 20 -preset medium \&lt;br /&gt;
-c:a aac -b:a 160k \&lt;br /&gt;
-movflags +faststart \&lt;br /&gt;
output.mp4&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Timestamps converted to seconds:&lt;br /&gt;
* 01:02–02:13 → 62–133&lt;br /&gt;
* 03:17–05:26 → 197–326&lt;br /&gt;
* 09:21–09:28 → 561–568&lt;br /&gt;
* 09:44–10:04 → 584–604&lt;br /&gt;
&lt;br /&gt;
: &lt;br /&gt;
&lt;br /&gt;
==== This tries to avoid re-encoding. Often works, but accuracy depends on keyframes. ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;ffmpeg -ss 01:02 -to 02:13 -i input.mp4 -c copy -avoid_negative_ts 1 part1.mp4&lt;br /&gt;
ffmpeg -ss 03:17 -to 05:26 -i input.mp4 -c copy -avoid_negative_ts 1 part2.mp4&lt;br /&gt;
ffmpeg -ss 09:21 -to 09:28 -i input.mp4 -c copy -avoid_negative_ts 1 part3.mp4&lt;br /&gt;
ffmpeg -ss 09:44 -to 10:04 -i input.mp4 -c copy -avoid_negative_ts 1 part4.mp4&lt;br /&gt;
&lt;br /&gt;
printf &amp;quot;file &amp;#039;part1.mp4&amp;#039;\nfile &amp;#039;part2.mp4&amp;#039;\nfile &amp;#039;part3.mp4&amp;#039;\nfile &amp;#039;part4.mp4&amp;#039;\n&amp;quot; &amp;gt; list.txt&lt;br /&gt;
ffmpeg -f concat -safe 0 -i list.txt -c copy output.mp4&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you tell me whether you want exact cuts (Option A) or fast/no re-encode (Option B), I can tailor the command for your codec/container constraints.&lt;br /&gt;
&lt;br /&gt;
=== User: actually i want them separate in order to check them ===&lt;br /&gt;
actually i want them separate in order to check them&lt;br /&gt;
also, i want to be able to cut up to miliseconds, if needed&lt;br /&gt;
&lt;br /&gt;
=== Assistant: Got it — make separate clips, and allow millisecond precision. ===&lt;br /&gt;
Got it — make separate clips, and allow millisecond precision.&lt;br /&gt;
&lt;br /&gt;
==== Use -ss/-to with input seeking (accurate) and re-encode. Put -ss after -i. ====&lt;br /&gt;
&lt;br /&gt;
===== &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;ffmpeg -i input.mp4 -ss 00:01:02.000 -to 00:02:13.000 \ =====&lt;br /&gt;
-c:v libx264 -crf 20 -preset medium -c:a aac -b:a 160k \&lt;br /&gt;
-movflags +faststart clip_01_0102-0213.mp4&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;ffmpeg -i input.mp4 -ss 00:03:17.000 -to 00:05:26.000 \ =====&lt;br /&gt;
-c:v libx264 -crf 20 -preset medium -c:a aac -b:a 160k \&lt;br /&gt;
-movflags +faststart clip_02_0317-0526.mp4&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;ffmpeg -i input.mp4 -ss 00:09:21.000 -to 00:09:28.000 \ =====&lt;br /&gt;
-c:v libx264 -crf 20 -preset medium -c:a aac -b:a 160k \&lt;br /&gt;
-movflags +faststart clip_03_0921-0928.mp4&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;ffmpeg -i input.mp4 -ss 00:09:44.000 -to 00:10:04.000 \ =====&lt;br /&gt;
-c:v libx264 -crf 20 -preset medium -c:a aac -b:a 160k \&lt;br /&gt;
-movflags +faststart clip_04_0944-1004.mp4&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Millisecond edits: just change .000 to whatever you need, e.g. 00:03:17.237.&lt;br /&gt;
&lt;br /&gt;
==== If you must keep original video quality, the only way to be frame/ms-accurate without re-encoding is basically impossible — stream copy can only cut cleanly on keyframes and audio packet boundaries. ====&lt;br /&gt;
&lt;br /&gt;
However, you can do “almost-original” by re-encoding only around cut points, but that’s more complex and usually not worth it unless quality is critical.&lt;br /&gt;
&lt;br /&gt;
==== With -ss after -i (like above), -to is treated as an end timestamp in the input timeline (works well for human timestamps). ====&lt;br /&gt;
&lt;br /&gt;
If you ever prefer “duration”, use -t instead:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;# from 01:02 for 71 seconds&lt;br /&gt;
ffmpeg -i input.mp4 -ss 00:01:02.000 -t 00:01:11.000 ...&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;in=&amp;quot;input.mp4&amp;quot; ====&lt;br /&gt;
&lt;br /&gt;
ffmpeg -i &amp;quot;$in&amp;quot; -ss 00:01:02.000 -to 00:02:13.000 -c:v libx264 -crf 20 -preset medium -c:a aac -b:a 160k -movflags +faststart clip_01.mp4&lt;br /&gt;
ffmpeg -i &amp;quot;$in&amp;quot; -ss 00:03:17.000 -to 00:05:26.000 -c:v libx264 -crf 20 -preset medium -c:a aac -b:a 160k -movflags +faststart clip_02.mp4&lt;br /&gt;
ffmpeg -i &amp;quot;$in&amp;quot; -ss 00:09:21.000 -to 00:09:28.000 -c:v libx264 -crf 20 -preset medium -c:a aac -b:a 160k -movflags +faststart clip_03.mp4&lt;br /&gt;
ffmpeg -i &amp;quot;$in&amp;quot; -ss 00:09:44.000 -to 00:10:04.000 -c:v libx264 -crf 20 -preset medium -c:a aac -b:a 160k -movflags +faststart clip_04.mp4&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you tell me your input codecs (paste ffprobe -hide_banner -i input.mp4), I can adjust settings to either keep the same FPS/resolution, preserve 5.1 audio, or speed it up with hardware encoding (NVENC/QSV/VAAPI).&lt;br /&gt;
&lt;br /&gt;
=== User: why are &amp;quot;-c:v libx264 -crf 20 -preset medium -c:a aac -b:a 160k -movflags +faststart&amp;quot; needed? ===&lt;br /&gt;
why are &amp;quot;-c:v libx264 -crf 20 -preset medium -c:a aac -b:a 160k -movflags +faststart&amp;quot; needed?&lt;br /&gt;
&lt;br /&gt;
=== Assistant: They’re not required to cut — they’re just the “safe defaults” that make the output widely playable and keep the cut ac… ===&lt;br /&gt;
They’re not required to cut — they’re just the “safe defaults” that make the output widely playable and keep the cut accurate.&lt;br /&gt;
&lt;br /&gt;
Here’s what each one does, and what happens if you remove it:&lt;br /&gt;
&lt;br /&gt;
===== Chooses the video encoder (H.264). =====&lt;br /&gt;
* If you don’t specify -c:v, ffmpeg will pick a default encoder for the output container (often still H.264, but not guaranteed).&lt;br /&gt;
* You could also use -c:v copy to avoid re-encoding, but then your cut won’t be millisecond-accurate (it’ll snap to keyframes / packet boundaries).&lt;br /&gt;
&lt;br /&gt;
===== Quality target for x264 (“constant quality” mode). Lower = higher quality/bigger file; higher = lower quality/smaller file. =====&lt;br /&gt;
* Not required; if omitted, x264 uses its default CRF (commonly 23), which is a bit lower quality.&lt;br /&gt;
* Typical range: 18–23.&lt;br /&gt;
&lt;br /&gt;
===== Encoding speed vs compression efficiency. =====&lt;br /&gt;
* Not required; x264 defaults to medium anyway.&lt;br /&gt;
* Slower presets = smaller file for same quality (but take longer).&lt;br /&gt;
&lt;br /&gt;
===== Re-encodes audio to AAC at 160 kbps. =====&lt;br /&gt;
* Not required; ffmpeg might pick AAC anyway, but again not guaranteed.&lt;br /&gt;
* If your source audio is already AAC and you don’t need frame-accurate audio boundaries, you might do -c:a copy. But for “exact cuts”, re-encoding audio avoids weird edge cases (missing samples, bad timestamps, concat issues later).&lt;br /&gt;
&lt;br /&gt;
===== Moves the MP4 “moov atom” to the beginning so the file can start playing before fully downloaded (web-friendly). =====&lt;br /&gt;
* Not required for local playback.&lt;br /&gt;
* It doesn’t change quality, only file layout.&lt;br /&gt;
&lt;br /&gt;
==== You said: separate clips + millisecond precision if needed. ====&lt;br /&gt;
&lt;br /&gt;
To cut with ms precision reliably, you generally need to decode and re-encode (at least video), because -c copy can only cut cleanly on keyframes and packet boundaries.&lt;br /&gt;
&lt;br /&gt;
So the shortest “ms-accurate” version is basically:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;ffmpeg -i input.mp4 -ss 00:01:02.000 -to 00:02:13.000 -c:v libx264 -c:a aac clip_01.mp4&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Everything else (-crf, -preset, -b:a, +faststart) is tuning / compatibility / convenience.&lt;br /&gt;
&lt;br /&gt;
==== This is still ms-accurate for video (because it re-encodes video), and keeps audio untouched: ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;ffmpeg -i input.mp4 -ss 00:01:02.000 -to 00:02:13.000 -c:v libx264 -crf 20 -preset medium -c:a copy clip_01.mp4&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Caveat: if you later concatenate clips, audio-copy can sometimes make concat pickier depending on timestamps/codec parameters.&lt;br /&gt;
&lt;br /&gt;
==== &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;ffmpeg -ss 00:01:02.000 -to 00:02:13.000 -i input.mp4 -c copy clip_01.mp4 ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Fast, no quality loss — but cuts may be off by up to a few seconds if keyframes are sparse.&lt;br /&gt;
&lt;br /&gt;
If you tell me whether your priority is (1) perfect accuracy or (2) no re-encode / perfect quality, I’ll give you the best exact command for that.&lt;br /&gt;
&lt;br /&gt;
=== User: i want to both preserve quality and be exact ===&lt;br /&gt;
i want to both preserve quality and be exact&lt;br /&gt;
&lt;br /&gt;
=== Assistant: You can’t have both in the strict, literal sense unless your cut points land exactly on keyframes and audio packet boun… ===&lt;br /&gt;
You can’t have both in the strict, literal sense unless your cut points land exactly on keyframes (and audio packet boundaries). Reason: with -c copy ffmpeg is not allowed to invent new frames, so it can only start a clip on an existing keyframe; “millisecond exact” usually requires decoding frames and re-encoding the first GOP.&lt;br /&gt;
&lt;br /&gt;
So you have two practical ways to get what you mean by “preserve quality”:&lt;br /&gt;
&lt;br /&gt;
==== This is the only “no quality change” method: ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;ffmpeg -ss 00:01:02.000 -to 00:02:13.000 -i input.mp4 -c copy clip_01.mp4&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
But it will only be exact to the ms if there’s a keyframe exactly at 00:01:02.000 (rare).&lt;br /&gt;
&lt;br /&gt;
==== You will re-encode, but you can make it lossless (or visually lossless). ====&lt;br /&gt;
&lt;br /&gt;
===== Per clip: =====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;ffmpeg -i input.mp4 -ss 00:01:02.000 -to 00:02:13.000 \&lt;br /&gt;
-c:v libx264 -qp 0 -preset veryslow \&lt;br /&gt;
-c:a copy \&lt;br /&gt;
clip_01_lossless.mkv&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
* -qp 0 = lossless for x264.&lt;br /&gt;
* I used MKV because it’s more forgiving; MP4 can be pickier with some codec combos.&lt;br /&gt;
* -c:a copy keeps audio unchanged.&lt;br /&gt;
&lt;br /&gt;
===== &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;ffmpeg -i input.mp4 -ss 00:01:02.000 -to 00:02:13.000 \ =====&lt;br /&gt;
-c:v libx264 -crf 16 -preset slow \&lt;br /&gt;
-c:a copy \&lt;br /&gt;
clip_01.mkv&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(You can use CRF 14–18 depending on how paranoid you are.)&lt;br /&gt;
&lt;br /&gt;
==== If you want the final clips to be -c copy and exact, you can first create a version that has keyframes exactly at your cut points: ====&lt;br /&gt;
&lt;br /&gt;
===== &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;ffmpeg -i input.mp4 \ =====&lt;br /&gt;
-c:v libx264 -qp 0 -preset veryslow \&lt;br /&gt;
-force_key_frames &amp;quot;00:01:02.000,00:02:13.000,00:03:17.000,00:05:26.000,00:09:21.000,00:09:28.000,00:09:44.000,00:10:04.000&amp;quot; \&lt;br /&gt;
-c:a copy \&lt;br /&gt;
keyed.mkv&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;ffmpeg -ss 00:01:02.000 -to 00:02:13.000 -i keyed.mkv -c copy clip_01.mkv =====&lt;br /&gt;
ffmpeg -ss 00:03:17.000 -to 00:05:26.000 -i keyed.mkv -c copy clip_02.mkv&lt;br /&gt;
ffmpeg -ss 00:09:21.000 -to 00:09:28.000 -i keyed.mkv -c copy clip_03.mkv&lt;br /&gt;
ffmpeg -ss 00:09:44.000 -to 00:10:04.000 -i keyed.mkv -c copy clip_04.mkv&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This still “changes” the video once (step 1), but with -qp 0 it’s lossless, so quality is preserved.&lt;br /&gt;
&lt;br /&gt;
If you tell me your source codec/pix_fmt (paste ffprobe -hide_banner -i input.mp4), I can adjust for 10-bit / HDR, H.265, or ensure audio stays compatible with MP4 if you really need MP4 outputs.&lt;br /&gt;
&lt;br /&gt;
=== User: here is the original video. ===&lt;br /&gt;
here is the original video. change your answer to fit its format/properties (in case any change does any improvement)&lt;br /&gt;
&lt;br /&gt;
=== Assistant: Your source is: ===&lt;br /&gt;
Your source is:&lt;br /&gt;
* Container: MKV&lt;br /&gt;
* Video: H.264 High, 1920×1080, 30 fps, yuv420p, BT.709 / TV range&lt;br /&gt;
* Audio: Opus, 48 kHz, stereo&lt;br /&gt;
&lt;br /&gt;
So the “best fit” output (same kind of file) is: MKV + H.264 + Opus, keeping 1080p/30fps/pix_fmt and BT.709 metadata.&lt;br /&gt;
&lt;br /&gt;
Because you want exact cuts and “preserve quality”, the most faithful option is lossless H.264 re-encode (x264 -qp 0). That guarantees exact timestamps (ms) and no generation loss (but files can be bigger).&lt;br /&gt;
&lt;br /&gt;
==== ### ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;ffmpeg -i &amp;quot;NEA MADALIN E DRAG QUEEN ACUM [P9gZEDOz9eE].mkv&amp;quot; -filter_complex \&lt;br /&gt;
&amp;quot;[0:v]trim=start=62:end=133,setpts=PTS-STARTPTS[v];[0:a]atrim=start=62:end=133,asetpts=PTS-STARTPTS[a]&amp;quot; \&lt;br /&gt;
-map &amp;quot;[v]&amp;quot; -map &amp;quot;[a]&amp;quot; \&lt;br /&gt;
-c:v libx264 -preset veryslow -qp 0 -pix_fmt yuv420p -profile:v high -level 4.0 \&lt;br /&gt;
-color_range tv -colorspace bt709 -color_trc bt709 -color_primaries bt709 \&lt;br /&gt;
-c:a libopus -b:a 160k -ar 48000 -ac 2 \&lt;br /&gt;
clip_01_0102-0213.mkv&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;ffmpeg -i &amp;quot;NEA MADALIN E DRAG QUEEN ACUM [P9gZEDOz9eE].mkv&amp;quot; -filter_complex \ =====&lt;br /&gt;
&amp;quot;[0:v]trim=start=197:end=326,setpts=PTS-STARTPTS[v];[0:a]atrim=start=197:end=326,asetpts=PTS-STARTPTS[a]&amp;quot; \&lt;br /&gt;
-map &amp;quot;[v]&amp;quot; -map &amp;quot;[a]&amp;quot; \&lt;br /&gt;
-c:v libx264 -preset veryslow -qp 0 -pix_fmt yuv420p -profile:v high -level 4.0 \&lt;br /&gt;
-color_range tv -colorspace bt709 -color_trc bt709 -color_primaries bt709 \&lt;br /&gt;
-c:a libopus -b:a 160k -ar 48000 -ac 2 \&lt;br /&gt;
clip_02_0317-0526.mkv&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;ffmpeg -i &amp;quot;NEA MADALIN E DRAG QUEEN ACUM [P9gZEDOz9eE].mkv&amp;quot; -filter_complex \ =====&lt;br /&gt;
&amp;quot;[0:v]trim=start=561:end=568,setpts=PTS-STARTPTS[v];[0:a]atrim=start=561:end=568,asetpts=PTS-STARTPTS[a]&amp;quot; \&lt;br /&gt;
-map &amp;quot;[v]&amp;quot; -map &amp;quot;[a]&amp;quot; \&lt;br /&gt;
-c:v libx264 -preset veryslow -qp 0 -pix_fmt yuv420p -profile:v high -level 4.0 \&lt;br /&gt;
-color_range tv -colorspace bt709 -color_trc bt709 -color_primaries bt709 \&lt;br /&gt;
-c:a libopus -b:a 160k -ar 48000 -ac 2 \&lt;br /&gt;
clip_03_0921-0928.mkv&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;ffmpeg -i &amp;quot;NEA MADALIN E DRAG QUEEN ACUM [P9gZEDOz9eE].mkv&amp;quot; -filter_complex \ =====&lt;br /&gt;
&amp;quot;[0:v]trim=start=584:end=604,setpts=PTS-STARTPTS[v];[0:a]atrim=start=584:end=604,asetpts=PTS-STARTPTS[a]&amp;quot; \&lt;br /&gt;
-map &amp;quot;[v]&amp;quot; -map &amp;quot;[a]&amp;quot; \&lt;br /&gt;
-c:v libx264 -preset veryslow -qp 0 -pix_fmt yuv420p -profile:v high -level 4.0 \&lt;br /&gt;
-color_range tv -colorspace bt709 -color_trc bt709 -color_primaries bt709 \&lt;br /&gt;
-c:a libopus -b:a 160k -ar 48000 -ac 2 \&lt;br /&gt;
clip_04_0944-1004.mkv&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Just use decimals in the start= / end= values, e.g.: =====&lt;br /&gt;
* trim=start=197.237:end=326.041&lt;br /&gt;
* atrim=start=197.237:end=326.041&lt;br /&gt;
&lt;br /&gt;
==== Same commands, just replace -qp 0 -preset veryslow with: ====&lt;br /&gt;
* Very high quality: -crf 16 -preset slow&lt;br /&gt;
* Still excellent: -crf 18 -preset slow&lt;br /&gt;
&lt;br /&gt;
Example swap:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;-c:v libx264 -crf 16 -preset slow&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== With MKV + Opus (and your file starting at -0.007s), trim/atrim + setpts/asetpts reliably: =====&lt;br /&gt;
* cuts exactly (including ms),&lt;br /&gt;
* resets each clip to start at t=0 cleanly,&lt;br /&gt;
* avoids weird negative start timestamps.&lt;br /&gt;
&lt;br /&gt;
If you want, tell me one clip where you need ms precision (start/end), and I’ll plug those exact values into the command for you.&lt;br /&gt;
&lt;br /&gt;
=== User: note that i still might need to cut up to miliseconds ===&lt;br /&gt;
note that i still might need to cut up to miliseconds&lt;br /&gt;
&lt;br /&gt;
=== Assistant: Yep — the approach I gave still works fine with milliseconds. ===&lt;br /&gt;
Yep — the approach I gave still works fine with milliseconds. You just put decimals on the cut points.&lt;br /&gt;
&lt;br /&gt;
===== You can do it either as seconds with decimals: =====&lt;br /&gt;
* start=62.137:end=133.904&lt;br /&gt;
&lt;br /&gt;
or as HH:MM:SS.mmm (ffmpeg accepts this format too, but inside trim it’s simplest to use seconds).&lt;br /&gt;
&lt;br /&gt;
===== Say you decide clip 2 should be 03:17.237 → 05:26.041. =====&lt;br /&gt;
&lt;br /&gt;
03:17.237 = 197.237 seconds&lt;br /&gt;
05:26.041 = 326.041 seconds&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;ffmpeg -i &amp;quot;NEA MADALIN E DRAG QUEEN ACUM [P9gZEDOz9eE].mkv&amp;quot; -filter_complex \&lt;br /&gt;
&amp;quot;[0:v]trim=start=197.237:end=326.041,setpts=PTS-STARTPTS[v]; \&lt;br /&gt;
 [0:a]atrim=start=197.237:end=326.041,asetpts=PTS-STARTPTS[a]&amp;quot; \&lt;br /&gt;
-map &amp;quot;[v]&amp;quot; -map &amp;quot;[a]&amp;quot; \&lt;br /&gt;
-c:v libx264 -preset veryslow -qp 0 -pix_fmt yuv420p -profile:v high -level 4.0 \&lt;br /&gt;
-color_range tv -colorspace bt709 -color_trc bt709 -color_primaries bt709 \&lt;br /&gt;
-c:a libopus -b:a 160k -ar 48000 -ac 2 \&lt;br /&gt;
clip_02_0317p237-0526p041.mkv&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Your video is 30 fps, so frames are spaced about 33.333 ms apart. =====&lt;br /&gt;
That means:&lt;br /&gt;
* You can type millisecond timestamps,&lt;br /&gt;
* but the actual video cut can only land on a frame boundary (≈33ms steps).&lt;br /&gt;
* Audio can be trimmed much more finely (sample-level).&lt;br /&gt;
&lt;br /&gt;
If you want, paste the exact ms cut points you end up with (like 01:02.153–02:13.087) and I’ll rewrite all 4 commands with those exact values.&lt;br /&gt;
&lt;br /&gt;
=== User: first one is 01:02.2 till 02:13.2 ===&lt;br /&gt;
first one is 01:02.2 till 02:13.2&lt;br /&gt;
&lt;br /&gt;
=== Assistant: Cool — for clip 1 you want 00:01:02.200 → 00:02:13.200 i.e. ===&lt;br /&gt;
Cool — for clip 1 you want 00:01:02.200 → 00:02:13.200 (i.e. 62.2s → 133.2s).&lt;br /&gt;
&lt;br /&gt;
===== &amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;ffmpeg -i &amp;quot;NEA MADALIN E DRAG QUEEN ACUM [P9gZEDOz9eE].mkv&amp;quot; -filter_complex \ =====&lt;br /&gt;
&amp;quot;[0:v]trim=start=62.2:end=133.2,setpts=PTS-STARTPTS[v]; \&lt;br /&gt;
 [0:a]atrim=start=62.2:end=133.2,asetpts=PTS-STARTPTS[a]&amp;quot; \&lt;br /&gt;
-map &amp;quot;[v]&amp;quot; -map &amp;quot;[a]&amp;quot; \&lt;br /&gt;
-c:v libx264 -preset veryslow -qp 0 -pix_fmt yuv420p -profile:v high -level 4.0 \&lt;br /&gt;
-color_range tv -colorspace bt709 -color_trc bt709 -color_primaries bt709 \&lt;br /&gt;
-c:a libopus -b:a 160k -ar 48000 -ac 2 \&lt;br /&gt;
clip_01_0102p2-0213p2.mkv&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Quick note: your video is 30 fps, so the video cut will land on the nearest frame boundary (~33.3 ms steps). Audio can still be trimmed more finely.&lt;br /&gt;
&lt;br /&gt;
=== User: $ ffmpeg -i &amp;quot;NEA MADALIN E DRAG QUEEN ACUM P9gZEDOz9eE.mkv&amp;quot; -filtercomplex \ ===&lt;br /&gt;
$ ffmpeg -i &amp;quot;NEA MADALIN E DRAG QUEEN ACUM [P9gZEDOz9eE].mkv&amp;quot; -filter_complex \&lt;br /&gt;
&amp;quot;[0:v]trim=start=62.2:end=133.2,setpts=PTS-STARTPTS[v]; \&lt;br /&gt;
 [0:a]atrim=start=62.2:end=133.2,asetpts=PTS-STARTPTS[a]&amp;quot; \&lt;br /&gt;
-map &amp;quot;[v]&amp;quot; -map &amp;quot;[a]&amp;quot; \&lt;br /&gt;
-c:v libx264 -preset veryslow -qp 0 -pix_fmt yuv420p -profile:v high -level 4.0 \&lt;br /&gt;
-color_range tv -colorspace bt709 -color_trc bt709 -color_primaries bt709 \&lt;br /&gt;
-c:a libopus -b:a 160k -ar 48000 -ac 2 \&lt;br /&gt;
clip_01_0102p2-0213p2.mkv&lt;br /&gt;
ffmpeg version 4.4.2-0ubuntu0.22.04.1 Copyright (c) 2000-2021 the FFmpeg developers&lt;br /&gt;
  built with gcc 11 (Ubuntu 11.2.0-19ubuntu1)&lt;br /&gt;
  configuration: --prefix=/usr --extra-version=0ubuntu0.22.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared&lt;br /&gt;
  WARNING: library configuration mismatch&lt;br /&gt;
  avcodec     configuration: --prefix=/usr --extra-version=0ubuntu0.22.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared --enable-version3 --disable-doc --disable-programs --enable-libaribb24 --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libtesseract --enable-libvo_amrwbenc --enable-libsmbclient&lt;br /&gt;
  libavutil      56. 70.100 / 56. 70.100&lt;br /&gt;
  libavcodec     58.134.100 / 58.134.100&lt;br /&gt;
  libavformat    58. 76.100 / 58. 76.100&lt;br /&gt;
  libavdevice    58. 13.100 / 58. 13.100&lt;br /&gt;
  libavfilter     7.110.100 /  7.110.100&lt;br /&gt;
  libswscale      5.  9.100 /  5.  9.100&lt;br /&gt;
  libswresample   3.  9.100 /  3.  9.100&lt;br /&gt;
  libpostproc    55.  9.100 / 55.  9.100&lt;br /&gt;
Input #0, matroska,webm, from &amp;#039;NEA MADALIN E DRAG QUEEN ACUM [P9gZEDOz9eE].mkv&amp;#039;:&lt;br /&gt;
  Metadata:&lt;br /&gt;
    COMPATIBLE_BRANDS: iso6avc1mp41&lt;br /&gt;
    MAJOR_BRAND     : dash&lt;br /&gt;
    MINOR_VERSION   : 0&lt;br /&gt;
    ENCODER         : Lavf58.76.100&lt;br /&gt;
  Duration: 00:25:49.28, start: -0.007000, bitrate: 2264 kb/s&lt;br /&gt;
  Stream #0:0: Video: h264 (High), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 30 fps, 30 tbr, 1k tbn, 60 tbc (default)&lt;br /&gt;
    Metadata:&lt;br /&gt;
      HANDLER_NAME    : ISO Media file produced by Google Inc.&lt;br /&gt;
      VENDOR_ID       : [0][0][0][0]&lt;br /&gt;
      DURATION        : 00:25:49.266000000&lt;br /&gt;
  Stream #0:1(eng): Audio: opus, 48000 Hz, stereo, fltp (default)&lt;br /&gt;
    Metadata:&lt;br /&gt;
      DURATION        : 00:25:49.281000000&lt;br /&gt;
Stream mapping:&lt;br /&gt;
  Stream #0:0 (h264) -&amp;gt; trim&lt;br /&gt;
  Stream #0:1 (opus) -&amp;gt; atrim&lt;br /&gt;
  setpts -&amp;gt; Stream #0:0 (libx264)&lt;br /&gt;
  asetpts -&amp;gt; Stream #0:1 (libopus)&lt;br /&gt;
Press [q] to stop, [?] for help&lt;br /&gt;
x264 [error]: high profile doesn&amp;#039;t support lossless&lt;br /&gt;
[libx264 @ 0x5874e72a1640] Error setting profile high.&lt;br /&gt;
[libx264 @ 0x5874e72a1640] Possible profiles: baseline main high high10 high422 high444&lt;br /&gt;
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height&lt;br /&gt;
[libopus @ 0x5874e739cb80] 1 frames left in the queue on closing&lt;br /&gt;
Conversion failed!&lt;br /&gt;
&lt;br /&gt;
=== Assistant: That error is because of this combo: ===&lt;br /&gt;
That error is because of this combo:&lt;br /&gt;
* -qp 0 = lossless&lt;br /&gt;
* -profile:v high = forces “High” profile&lt;br /&gt;
&lt;br /&gt;
x264 refuses that: “high profile doesn&amp;#039;t support lossless”. For lossless, x264 switches to a different profile (typically High 4:4:4 Predictive) automatically. When you force high, it can’t.&lt;br /&gt;
&lt;br /&gt;
===== Use this: =====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;ffmpeg -i &amp;quot;NEA MADALIN E DRAG QUEEN ACUM [P9gZEDOz9eE].mkv&amp;quot; -filter_complex \&lt;br /&gt;
&amp;quot;[0:v]trim=start=62.2:end=133.2,setpts=PTS-STARTPTS[v]; \&lt;br /&gt;
 [0:a]atrim=start=62.2:end=133.2,asetpts=PTS-STARTPTS[a]&amp;quot; \&lt;br /&gt;
-map &amp;quot;[v]&amp;quot; -map &amp;quot;[a]&amp;quot; \&lt;br /&gt;
-c:v libx264 -preset veryslow -qp 0 -pix_fmt yuv420p \&lt;br /&gt;
-c:a libopus -b:a 160k -ar 48000 -ac 2 \&lt;br /&gt;
clip_01_0102p2-0213p2.mkv&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
That will cut exactly (including milliseconds) and keep video lossless.&lt;br /&gt;
&lt;br /&gt;
===== Even though your pixel format stays yuv420p, a lossless x264 encode often signals a profile like High 4:4:4 Predictive. Some hardware players (TVs/phones) may not like that, even if VLC/mpv do. =====&lt;br /&gt;
&lt;br /&gt;
If you want maximum compatibility while still being visually indistinguishable from the source, do this instead:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;ffmpeg -i &amp;quot;NEA MADALIN E DRAG QUEEN ACUM [P9gZEDOz9eE].mkv&amp;quot; -filter_complex \&lt;br /&gt;
&amp;quot;[0:v]trim=start=62.2:end=133.2,setpts=PTS-STARTPTS[v]; \&lt;br /&gt;
 [0:a]atrim=start=62.2:end=133.2,asetpts=PTS-STARTPTS[a]&amp;quot; \&lt;br /&gt;
-map &amp;quot;[v]&amp;quot; -map &amp;quot;[a]&amp;quot; \&lt;br /&gt;
-c:v libx264 -crf 16 -preset slow -pix_fmt yuv420p -profile:v high -level 4.0 \&lt;br /&gt;
-c:a libopus -b:a 160k -ar 48000 -ac 2 \&lt;br /&gt;
clip_01_0102p2-0213p2.mkv&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===== Just change 62.2 / 133.2 to e.g. 62.237 / 133.041. =====&lt;br /&gt;
&lt;br /&gt;
If you send the ms-precise times for the other 3 clips, I’ll spit out all 4 final commands in the same style.&lt;br /&gt;
&lt;br /&gt;
=== User: second is 03:17.10 to 05:26.20 ===&lt;br /&gt;
second is 03:17.10 to 05:26.20&lt;br /&gt;
&lt;br /&gt;
=== Assistant: Great — that’s: ===&lt;br /&gt;
Great — that’s:&lt;br /&gt;
* start 00:03:17.100 = 197.1 seconds&lt;br /&gt;
* end 00:05:26.200 = 326.2 seconds&lt;br /&gt;
&lt;br /&gt;
Here’s the matching command (same settings as the fixed lossless version — no forced -profile:v high):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;ffmpeg -i &amp;quot;NEA MADALIN E DRAG QUEEN ACUM [P9gZEDOz9eE].mkv&amp;quot; -filter_complex \&lt;br /&gt;
&amp;quot;[0:v]trim=start=197.1:end=326.2,setpts=PTS-STARTPTS[v]; \&lt;br /&gt;
 [0:a]atrim=start=197.1:end=326.2,asetpts=PTS-STARTPTS[a]&amp;quot; \&lt;br /&gt;
-map &amp;quot;[v]&amp;quot; -map &amp;quot;[a]&amp;quot; \&lt;br /&gt;
-c:v libx264 -preset veryslow -qp 0 -pix_fmt yuv420p \&lt;br /&gt;
-c:a libopus -b:a 160k -ar 48000 -ac 2 \&lt;br /&gt;
clip_02_0317p10-0526p20.mkv&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want the filename to reflect milliseconds more clearly, you can rename it after (or I can format it differently).&lt;br /&gt;
&lt;br /&gt;
Send clip 3 + 4 ms times when ready.&lt;br /&gt;
&lt;br /&gt;
=== User: 09:21:00 till 09:28:30 ===&lt;br /&gt;
09:21:00 till 09:28:30&lt;br /&gt;
&lt;br /&gt;
=== Assistant: That’s: ===&lt;br /&gt;
That’s:&lt;br /&gt;
* start 00:09:21.000 = 561.0 seconds&lt;br /&gt;
* end 00:09:28.300 = 568.3 seconds&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;ffmpeg -i &amp;quot;NEA MADALIN E DRAG QUEEN ACUM [P9gZEDOz9eE].mkv&amp;quot; -filter_complex \&lt;br /&gt;
&amp;quot;[0:v]trim=start=561.0:end=568.3,setpts=PTS-STARTPTS[v]; \&lt;br /&gt;
 [0:a]atrim=start=561.0:end=568.3,asetpts=PTS-STARTPTS[a]&amp;quot; \&lt;br /&gt;
-map &amp;quot;[v]&amp;quot; -map &amp;quot;[a]&amp;quot; \&lt;br /&gt;
-c:v libx264 -preset veryslow -qp 0 -pix_fmt yuv420p \&lt;br /&gt;
-c:a libopus -b:a 160k -ar 48000 -ac 2 \&lt;br /&gt;
clip_03_0921p00-0928p30.mkv&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Send the last interval (09:44–10:04 with ms) and I’ll format that one too.&lt;br /&gt;
&lt;br /&gt;
=== User: 09:44:10 to 10:04:20 ===&lt;br /&gt;
09:44:10 to 10:04:20&lt;br /&gt;
&lt;br /&gt;
=== Assistant: That’s: ===&lt;br /&gt;
That’s:&lt;br /&gt;
* start 00:09:44.100 = 584.1 seconds&lt;br /&gt;
* end 00:10:04.200 = 604.2 seconds&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;ffmpeg -i &amp;quot;NEA MADALIN E DRAG QUEEN ACUM [P9gZEDOz9eE].mkv&amp;quot; -filter_complex \&lt;br /&gt;
&amp;quot;[0:v]trim=start=584.1:end=604.2,setpts=PTS-STARTPTS[v]; \&lt;br /&gt;
 [0:a]atrim=start=584.1:end=604.2,asetpts=PTS-STARTPTS[a]&amp;quot; \&lt;br /&gt;
-map &amp;quot;[v]&amp;quot; -map &amp;quot;[a]&amp;quot; \&lt;br /&gt;
-c:v libx264 -preset veryslow -qp 0 -pix_fmt yuv420p \&lt;br /&gt;
-c:a libopus -b:a 160k -ar 48000 -ac 2 \&lt;br /&gt;
clip_04_0944p10-1004p20.mkv&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want, here are all four commands together (same settings) so you can paste once:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;in=&amp;quot;NEA MADALIN E DRAG QUEEN ACUM [P9gZEDOz9eE].mkv&amp;quot;&lt;br /&gt;
&lt;br /&gt;
ffmpeg -i &amp;quot;$in&amp;quot; -filter_complex &amp;quot;[0:v]trim=start=62.2:end=133.2,setpts=PTS-STARTPTS[v];[0:a]atrim=start=62.2:end=133.2,asetpts=PTS-STARTPTS[a]&amp;quot;  -map &amp;quot;[v]&amp;quot; -map &amp;quot;[a]&amp;quot; -c:v libx264 -preset veryslow -qp 0 -pix_fmt yuv420p -c:a libopus -b:a 160k -ar 48000 -ac 2 clip_01_0102p20-0213p20.mkv&lt;br /&gt;
ffmpeg -i &amp;quot;$in&amp;quot; -filter_complex &amp;quot;[0:v]trim=start=197.1:end=326.2,setpts=PTS-STARTPTS[v];[0:a]atrim=start=197.1:end=326.2,asetpts=PTS-STARTPTS[a]&amp;quot; -map &amp;quot;[v]&amp;quot; -map &amp;quot;[a]&amp;quot; -c:v libx264 -preset veryslow -qp 0 -pix_fmt yuv420p -c:a libopus -b:a 160k -ar 48000 -ac 2 clip_02_0317p10-0526p20.mkv&lt;br /&gt;
ffmpeg -i &amp;quot;$in&amp;quot; -filter_complex &amp;quot;[0:v]trim=start=561.0:end=568.3,setpts=PTS-STARTPTS[v];[0:a]atrim=start=561.0:end=568.3,asetpts=PTS-STARTPTS[a]&amp;quot; -map &amp;quot;[v]&amp;quot; -map &amp;quot;[a]&amp;quot; -c:v libx264 -preset veryslow -qp 0 -pix_fmt yuv420p -c:a libopus -b:a 160k -ar 48000 -ac 2 clip_03_0921p00-0928p30.mkv&lt;br /&gt;
ffmpeg -i &amp;quot;$in&amp;quot; -filter_complex &amp;quot;[0:v]trim=start=584.1:end=604.2,setpts=PTS-STARTPTS[v];[0:a]atrim=start=584.1:end=604.2,asetpts=PTS-STARTPTS[a]&amp;quot; -map &amp;quot;[v]&amp;quot; -map &amp;quot;[a]&amp;quot; -c:v libx264 -preset veryslow -qp 0 -pix_fmt yuv420p -c:a libopus -b:a 160k -ar 48000 -ac 2 clip_04_0944p10-1004p20.mkv&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== User: ok, now in a single ffmpeg command create the combined video of the cuts ===&lt;br /&gt;
ok, now in a single ffmpeg command create the combined video of the cuts&lt;br /&gt;
&lt;br /&gt;
=== Assistant: Here’s a single ffmpeg command that cuts your 4 timestamp ranges with milliseconds and concats them into one output. ===&lt;br /&gt;
Here’s a single ffmpeg command that cuts your 4 timestamp ranges (with milliseconds) and concats them into one output.&lt;br /&gt;
&lt;br /&gt;
===== Combined output (exact cuts, lossless video, MKV + H.264 + Opus) =====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;ffmpeg -i &amp;quot;NEA MADALIN E DRAG QUEEN ACUM [P9gZEDOz9eE].mkv&amp;quot; -filter_complex \&lt;br /&gt;
&amp;quot;[0:v]trim=start=62.2:end=133.2,setpts=PTS-STARTPTS[v0]; \&lt;br /&gt;
 [0:a]atrim=start=62.2:end=133.2,asetpts=PTS-STARTPTS[a0]; \&lt;br /&gt;
 [0:v]trim=start=197.1:end=326.2,setpts=PTS-STARTPTS[v1]; \&lt;br /&gt;
 [0:a]atrim=start=197.1:end=326.2,asetpts=PTS-STARTPTS[a1]; \&lt;br /&gt;
 [0:v]trim=start=561.0:end=568.3,setpts=PTS-STARTPTS[v2]; \&lt;br /&gt;
 [0:a]atrim=start=561.0:end=568.3,asetpts=PTS-STARTPTS[a2]; \&lt;br /&gt;
 [0:v]trim=start=584.1:end=604.2,setpts=PTS-STARTPTS[v3]; \&lt;br /&gt;
 [0:a]atrim=start=584.1:end=604.2,asetpts=PTS-STARTPTS[a3]; \&lt;br /&gt;
 [v0][a0][v1][a1][v2][a2][v3][a3]concat=n=4:v=1:a=1[v][a]&amp;quot; \&lt;br /&gt;
-map &amp;quot;[v]&amp;quot; -map &amp;quot;[a]&amp;quot; \&lt;br /&gt;
-c:v libx264 -preset veryslow -qp 0 -pix_fmt yuv420p \&lt;br /&gt;
-c:a libopus -b:a 160k -ar 48000 -ac 2 \&lt;br /&gt;
combined_cuts.mkv&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you decide “lossless” is overkill and you want maximum playback compatibility (High profile) while still looking identical to most eyes, swap the video settings to:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;-c:v libx264 -crf 16 -preset slow -pix_fmt yuv420p -profile:v high -level 4.0&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(Everything else can stay the same.)&lt;br /&gt;
&lt;br /&gt;
=== User: how much will be duration of the new video? ===&lt;br /&gt;
how much will be duration of the new video?&lt;br /&gt;
&lt;br /&gt;
=== Assistant: Let’s add up each kept segment: ===&lt;br /&gt;
Let’s add up each kept segment:&lt;br /&gt;
# 01:02.200 → 02:13.200 133.2 − 62.2 = 71.0 s&lt;br /&gt;
# 03:17.100 → 05:26.200 326.2 − 197.1 = 129.1 s&lt;br /&gt;
# 09:21.000 → 09:28.300 568.3 − 561.0 = 7.3 s&lt;br /&gt;
# 09:44.100 → 10:04.200 604.2 − 584.1 = 20.1 s&lt;br /&gt;
&lt;br /&gt;
Total = 71.0 + 129.1 + 7.3 + 20.1 = 227.5 seconds&lt;br /&gt;
= 3 minutes 47.5 seconds (i.e., 00:03:47.500)&lt;br /&gt;
&lt;br /&gt;
=== User: do cummulative sum and also convert into minutes so i can see where the cuts are of the total ===&lt;br /&gt;
do cummulative sum (and also convert into minutes) so i can see where the cuts are of the total&lt;br /&gt;
&lt;br /&gt;
=== Assistant: Sure — here are the segment lengths and the cumulative timeline in the new combined video. ===&lt;br /&gt;
Sure — here are the segment lengths and the cumulative timeline in the new combined video.&lt;br /&gt;
&lt;br /&gt;
===== Segment durations =====&lt;br /&gt;
* S1 (01:02.200 → 02:13.200): 71.000 s = 1.1833 min = 01:11.000&lt;br /&gt;
* S2 (03:17.100 → 05:26.200): 129.100 s = 2.1517 min = 02:09.100&lt;br /&gt;
* S3 (09:21.000 → 09:28.300): 7.300 s = 0.1217 min = 00:07.300&lt;br /&gt;
* S4 (09:44.100 → 10:04.200): 20.100 s = 0.3350 min = 00:20.100&lt;br /&gt;
&lt;br /&gt;
===== Cumulative positions in the combined output =====&lt;br /&gt;
&lt;br /&gt;
| Segment | In source           | Duration  | Starts at (new) | Ends at (new) | End (minutes) |&lt;br /&gt;
| ------- | ------------------- | --------- | --------------- | ------------- | ------------- |&lt;br /&gt;
| S1      | 01:02.200–02:13.200 | 71.000 s  | 00:00.000       | 01:11.000     | 1.1833 min    |&lt;br /&gt;
| S2      | 03:17.100–05:26.200 | 129.100 s | 01:11.000       | 03:20.100     | 3.3350 min    |&lt;br /&gt;
| S3      | 09:21.000–09:28.300 | 7.300 s   | 03:20.100       | 03:27.400     | 3.4567 min    |&lt;br /&gt;
| S4      | 09:44.100–10:04.200 | 20.100 s  | 03:27.400       | 03:47.500     | 3.7917 min    |&lt;br /&gt;
&lt;br /&gt;
Total combined duration: 227.500 s = 3.7917 min = 03:47.500&lt;br /&gt;
&lt;br /&gt;
=== User: make the table ascii only ===&lt;br /&gt;
make the table ascii only&lt;br /&gt;
&lt;br /&gt;
=== Assistant:  ===&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;+---------+-------------------------+-----------+----------------+----------------+-------------+&lt;br /&gt;
| Segment | In source                | Duration  | Starts at (new) | Ends at (new)   | End (min)   |&lt;br /&gt;
+---------+-------------------------+-----------+----------------+----------------+-------------+&lt;br /&gt;
| S1      | 01:02.200 - 02:13.200   | 01:11.000 | 00:00.000      | 01:11.000      | 1.1833 min  |&lt;br /&gt;
| S2      | 03:17.100 - 05:26.200   | 02:09.100 | 01:11.000      | 03:20.100      | 3.3350 min  |&lt;br /&gt;
| S3      | 09:21.000 - 09:28.300   | 00:07.300 | 03:20.100      | 03:27.400      | 3.4567 min  |&lt;br /&gt;
| S4      | 09:44.100 - 10:04.200   | 00:20.100 | 03:27.400      | 03:47.500      | 3.7917 min  |&lt;br /&gt;
+---------+-------------------------+-----------+----------------+----------------+-------------+&lt;br /&gt;
| TOTAL   |                         | 03:47.500 |                |                | 3.7917 min  |&lt;br /&gt;
+---------+-------------------------+-----------+----------------+----------------+-------------+&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:ChatGPT Shares]]&lt;br /&gt;
[[Category:openai]]&lt;/div&gt;</summary>
		<author><name>Lukegao</name></author>
	</entry>
</feed>