Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
freem
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Openai/6957d2e8-b738-8008-987a-09a5d9f29bc8
(section)
Add languages
Page
Discussion
English
Read
Edit
Edit source
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
Edit source
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Assistant: Your source is: === Your source is: * Container: MKV * Video: H.264 High, 1920×1080, 30 fps, yuv420p, BT.709 / TV range * Audio: Opus, 48 kHz, stereo So the “best fit” output (same kind of file) is: MKV + H.264 + Opus, keeping 1080p/30fps/pix_fmt and BT.709 metadata. 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). ==== ### ==== <syntaxhighlight lang="bash">ffmpeg -i "NEA MADALIN E DRAG QUEEN ACUM [P9gZEDOz9eE].mkv" -filter_complex \ "[0:v]trim=start=62:end=133,setpts=PTS-STARTPTS[v];[0:a]atrim=start=62:end=133,asetpts=PTS-STARTPTS[a]" \ -map "[v]" -map "[a]" \ -c:v libx264 -preset veryslow -qp 0 -pix_fmt yuv420p -profile:v high -level 4.0 \ -color_range tv -colorspace bt709 -color_trc bt709 -color_primaries bt709 \ -c:a libopus -b:a 160k -ar 48000 -ac 2 \ clip_01_0102-0213.mkv </syntaxhighlight> ===== <syntaxhighlight lang="bash">ffmpeg -i "NEA MADALIN E DRAG QUEEN ACUM [P9gZEDOz9eE].mkv" -filter_complex \ ===== "[0:v]trim=start=197:end=326,setpts=PTS-STARTPTS[v];[0:a]atrim=start=197:end=326,asetpts=PTS-STARTPTS[a]" \ -map "[v]" -map "[a]" \ -c:v libx264 -preset veryslow -qp 0 -pix_fmt yuv420p -profile:v high -level 4.0 \ -color_range tv -colorspace bt709 -color_trc bt709 -color_primaries bt709 \ -c:a libopus -b:a 160k -ar 48000 -ac 2 \ clip_02_0317-0526.mkv </syntaxhighlight> ===== <syntaxhighlight lang="bash">ffmpeg -i "NEA MADALIN E DRAG QUEEN ACUM [P9gZEDOz9eE].mkv" -filter_complex \ ===== "[0:v]trim=start=561:end=568,setpts=PTS-STARTPTS[v];[0:a]atrim=start=561:end=568,asetpts=PTS-STARTPTS[a]" \ -map "[v]" -map "[a]" \ -c:v libx264 -preset veryslow -qp 0 -pix_fmt yuv420p -profile:v high -level 4.0 \ -color_range tv -colorspace bt709 -color_trc bt709 -color_primaries bt709 \ -c:a libopus -b:a 160k -ar 48000 -ac 2 \ clip_03_0921-0928.mkv </syntaxhighlight> ===== <syntaxhighlight lang="bash">ffmpeg -i "NEA MADALIN E DRAG QUEEN ACUM [P9gZEDOz9eE].mkv" -filter_complex \ ===== "[0:v]trim=start=584:end=604,setpts=PTS-STARTPTS[v];[0:a]atrim=start=584:end=604,asetpts=PTS-STARTPTS[a]" \ -map "[v]" -map "[a]" \ -c:v libx264 -preset veryslow -qp 0 -pix_fmt yuv420p -profile:v high -level 4.0 \ -color_range tv -colorspace bt709 -color_trc bt709 -color_primaries bt709 \ -c:a libopus -b:a 160k -ar 48000 -ac 2 \ clip_04_0944-1004.mkv </syntaxhighlight> ===== Just use decimals in the start= / end= values, e.g.: ===== * trim=start=197.237:end=326.041 * atrim=start=197.237:end=326.041 ==== Same commands, just replace -qp 0 -preset veryslow with: ==== * Very high quality: -crf 16 -preset slow * Still excellent: -crf 18 -preset slow Example swap: <syntaxhighlight lang="bash">-c:v libx264 -crf 16 -preset slow </syntaxhighlight> ===== With MKV + Opus (and your file starting at -0.007s), trim/atrim + setpts/asetpts reliably: ===== * cuts exactly (including ms), * resets each clip to start at t=0 cleanly, * avoids weird negative start timestamps. 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.
Summary:
Please note that all contributions to freem are considered to be released under the Creative Commons Attribution-ShareAlike 4.0 (see
Freem:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)