Apply parameters from one video to another?

I have a 1080p video I want to replace the start of with video from another that’s slightly lower resolution. I’ve already made the replacement clip, upscaled it to match and converted to MP4 AVC - but to make it join seamlessly when reencoded every parameter should be the same. The cut is at a keyframe that’s in exactly the same place in both videos at a hard scene break.

What would be ideal is if ShotCut can read the information from one video then save that data. Then load a second video, set the cut point then reencode and rescale with the codec and all parameters from the first video applied. Then a seamless cut and passthrough copy/join should be possible without having to reencode the large chunk of the first video.

Audio doesn’t matter because I’ll be extracting and remuxing the whole audio stream from the original 1080p video.

Here’s the specs from the video I want to cut the start off.

Format : Matroska
Format version : Version 4 / Version 2
File size : 1.38 GiB
Duration : 26 min 37 s
Overall bit rate : 7 419 kb/s
Encoded date : UTC 2018-03-08 07:00:52
Writing application : mkvmerge v20.0.0 (‘I Am The Sun’) 64-bit
Writing library : libebml v1.3.5 + libmatroska v1.4.8

Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L4.1
Format settings : CABAC / 4 Ref Frames
Format settings, CABAC : Yes
Format settings, ReFrames : 4 frames
Codec ID : V_MPEG4/ISO/AVC
Duration : 26 min 37 s
Bit rate : 6 970 kb/s
Width : 1 920 pixels
Height : 1 080 pixels
Display aspect ratio : 16:9
Frame rate mode : Constant
Frame rate : 23.976 (24000/1001) FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.140
Stream size : 1.30 GiB (94%)
Title : @RK
Writing library : x264 core 142 r2479 dd79a61
Encoding settings : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=7 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=12 / lookahead_threads=2 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=2 / keyint=240 / keyint_min=24 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=crf / mbtree=1 / crf=18.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / vbv_maxrate=62500 / vbv_bufsize=78125 / crf_max=0.0 / nal_hrd=none / filler=0 / ip_ratio=1.40 / aq=1:1.00
Language : English
Default : Yes
Forced : No
Color range : Limited
Color primaries : BT.709
Transfer characteristics : BT.709
Matrix coefficients : BT.709

The specs from the video I want to take the start from.

Format : Matroska
Format version : Version 4 / Version 2
File size : 411 MiB
Duration : 26 min 37 s
Overall bit rate : 2 157 kb/s
Encoded date : UTC 2018-03-07 03:20:53
Writing application : mkvmerge v20.0.0 (‘I Am The Sun’) 64-bit
Writing library : libebml v1.3.5 + libmatroska v1.4.8

Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L3.1
Format settings : CABAC / 4 Ref Frames
Format settings, CABAC : Yes
Format settings, ReFrames : 4 frames
Codec ID : V_MPEG4/ISO/AVC
Duration : 26 min 37 s
Bit rate : 1 990 kb/s
Width : 1 280 pixels
Height : 720 pixels
Display aspect ratio : 16:9
Frame rate mode : Constant
Frame rate : 23.976 (24000/1001) FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.090
Stream size : 379 MiB (92%)
Writing library : x264 core 142 r2479 dd79a61
Encoding settings : cabac=1 / ref=4 / deblock=1:0:0 / analyse=0x3:0x133 / me=umh / subme=10 / psy=1 / psy_rd=1.00:0.15 / mixed_ref=1 / me_range=32 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-3 / threads=12 / lookahead_threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=4 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=240 / keyint_min=24 / scenecut=40 / intra_refresh=0 / rc_lookahead=60 / rc=crf / mbtree=1 / crf=21.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / vbv_maxrate=17500 / vbv_bufsize=17500 / crf_max=0.0 / nal_hrd=none / filler=0 / ip_ratio=1.40 / aq=1:1.00
Language : English
Default : Yes
Forced : No
Color range : Limited
Color primaries : BT.709
Transfer characteristics : BT.709
Matrix coefficients : BT.709

Not that simple… The bitrate is 4 times higher than the one you have as reference…

But anyway, SHOTCUT re endode. That’s it. if you just want to cut, use something elase.
You can use some MKV extract tool and then a mpeg4 cutter.
Then repack with mkvmerge.

1 Like

You may try avidemux if you simply want to cut. It has an option to copy audio and video. Perhaps that only works if the split point is in a keyframe, or maybe it just encodes a GOP up to the next keyframe.

The same feature exists in Shotcut. It’s the “Extract Sub-clip” option in the Properties tab. Although if the chosen start and end aren’t at a keyframe then the video might be corrupted at the start and end but that’s the current limitation of that FFmpeg command.

1 Like