possibly related #2518
from email (some assisted by AI):
Steps to reproduce
- Keyframe cut enabled
- Cut a video
Only happens on some files.
Expected behavior
No corruption. Used to work in v3.64 (maybe?). Output file from v3.64 with ffprobe:
ffprobe -v error -show_entries stream=codec_name,duration,nb_frames:format=duration,size -of json ".\original-00.00.00.000-00.00.30.000_old.mp4"
{
"programs": [
],
"stream_groups": [
],
"streams": [
{
"codec_name": "hevc",
"duration": "30.046683",
"nb_frames": "1801"
},
{
"codec_name": "aac",
"duration": "30.004000",
"nb_frames": "1408"
}
],
"format": {
"duration": "30.046683",
"size": "222731273"
}
}
Actual behavior
Output is corrupted / unplayable (not sure what that means exactly). Output file from 3.67.1 gives error in ffprobe:
ffprobe -v error -show_entries stream=codec_name,duration,nb_frames:format=duration,size -of json ".\original-00.00.00.000-00.00.30.000_new.mp4"
{
[extract_extradata @ 0000029729fc4280] No start code is found.
.\original-00.00.00.000-00.00.30.000_new.mp4: Invalid data found when processing input
Cutting manually with ffmpeg to cut video works:
# WORKS:
ffmpeg -i "G:\vr\tocut\original.mp4" -t 30 -c:v copy -bsf:v hevc_metadata=aud=insert -c:a copy -tag:v hvc1 -movflags +faststart -y "G:\vr\tocut\test-aud.mp4"
Without the AUD part or HEV1 it usually would not play:
# DOES NOT WORK:
ffmpeg -i "G:\tocut\original.mp4" -t 30 -c:v copy -bsf:v dump_extra=freq=keyframe -c:a copy -tag:v hvc1 -movflags +faststart -y "G:\tocut\test-dump-extra.mp4"
Suggests AUD part is needed, and suspects this problem is about in-stream AUD handling and preserving. AI also initially sugested that old Losslesscut version is looking for keyframes to match more closely but I am not so sure.
Share log from developer tools
Original file ffprobe:
{
"streams": [
{
"index": 0,
"codec_name": "hevc",
"codec_long_name": "H.265 / HEVC (High Efficiency Video Coding)",
"profile": "Main",
"codec_type": "video",
"codec_tag_string": "hev1",
"codec_tag": "0x31766568",
"width": 8192,
"height": 4096,
"coded_width": 8192,
"coded_height": 4096,
"closed_captions": 0,
"film_grain": 0,
"has_b_frames": 2,
"sample_aspect_ratio": "1:1",
"display_aspect_ratio": "2:1",
"pix_fmt": "yuv420p",
"level": 183,
"color_range": "tv",
"color_space": "bt709",
"color_transfer": "bt709",
"color_primaries": "bt709",
"chroma_location": "left",
"refs": 1,
"view_ids_available": "",
"view_pos_available": "",
"id": "0x1",
"r_frame_rate": "60000/1001",
"avg_frame_rate": "60000/1001",
"time_base": "1/60000",
"start_pts": 0,
"start_time": "0.000000",
"duration_ts": 164827663,
"duration": "2747.127717",
"bit_rate": "59345762",
"nb_frames": "164663",
"extradata_size": 23,
"disposition": {
"default": 1,
"dub": 0,
"original": 0,
"comment": 0,
"lyrics": 0,
"karaoke": 0,
"forced": 0,
"hearing_impaired": 0,
"visual_impaired": 0,
"clean_effects": 0,
"attached_pic": 0,
"timed_thumbnails": 0,
"non_diegetic": 0,
"captions": 0,
"descriptions": 0,
"metadata": 0,
"dependent": 0,
"still_image": 0,
"multilayer": 0
},
"tags": {
"creation_time": "2024-07-16T16:40:10.000000Z",
"language": "und",
"handler_name": "ETI ISO Video Media Handler",
"vendor_id": "[0][0][0][0]",
"encoder": "\u000bHEVC Coding"
}
},
{
"index": 1,
"codec_name": "aac",
"codec_long_name": "AAC (Advanced Audio Coding)",
"profile": "LC",
"codec_type": "audio",
"codec_tag_string": "mp4a",
"codec_tag": "0x6134706d",
"sample_fmt": "fltp",
"sample_rate": "48000",
"channels": 2,
"channel_layout": "stereo",
"bits_per_sample": 0,
"initial_padding": 0,
"id": "0x2",
"r_frame_rate": "0/0",
"avg_frame_rate": "0/0",
"time_base": "1/48000",
"start_pts": 0,
"start_time": "0.000000",
"duration_ts": 131860928,
"duration": "2747.102667",
"bit_rate": "320000",
"nb_frames": "128772",
"extradata_size": 2,
"disposition": {
"default": 1,
"dub": 0,
"original": 0,
"comment": 0,
"lyrics": 0,
"karaoke": 0,
"forced": 0,
"hearing_impaired": 0,
"visual_impaired": 0,
"clean_effects": 0,
"attached_pic": 0,
"timed_thumbnails": 0,
"non_diegetic": 0,
"captions": 0,
"descriptions": 0,
"metadata": 0,
"dependent": 0,
"still_image": 0,
"multilayer": 0
},
"tags": {
"creation_time": "2024-07-16T16:40:11.000000Z",
"language": "eng",
"handler_name": "ETI ISO Audio Media Handler",
"vendor_id": "[0][0][0][0]"
}
}
],
"chapters": [
],
"format": {
"filename": "original.mp4",
"nb_streams": 2,
"nb_programs": 0,
"nb_stream_groups": 0,
"format_name": "mov,mp4,m4a,3gp,3g2,mj2",
"format_long_name": "QuickTime / MOV",
"start_time": "0.000000",
"duration": "2747.127717",
"size": "20494043301",
"bit_rate": "59681370",
"probe_score": 100,
"tags": {
"major_brand": "isom",
"minor_version": "1",
"compatible_brands": "isom",
"creation_time": "2024-07-16T16:40:10.000000Z"
}
}
}
LosslessCut ffmpeg command:
ffmpeg.ts:49 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'G:\tocut\original.mp4':
Metadata:
major_brand : isom
minor_version : 1
compatible_brands: isom
creation_time : 2024-07-16T16:40:10.000000Z
Duration: 00:45:47.13, start: 0.000000, bitrate: 59681 kb/s
Stream #0:0[0x1](und): Video: hevc (Main) (hev1 / 0x31766568), yuv420p(tv, bt709), 8192x4096 [SAR 1:1 DAR 2:1], 59345 kb/s, 59.94 fps, 59.94 tbr, 60k tbn (default)
Metadata:
creation_time : 2024-07-16T16:40:10.000000Z
handler_name : ETI ISO Video Media Handler
vendor_id : [0][0][0][0]
encoder : HEVC Coding
Stream #0:1[0x2](eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 320 kb/s (default)
Metadata:
creation_time : 2024-07-16T16:40:11.000000Z
handler_name : ETI ISO Audio Media Handler
vendor_id : [0][0][0][0]
Output #0, mp4, to 'G:\_toconvert\f1307_12_noav\original-00.00.00.000-00.00.30.000.mp4':
Metadata:
major_brand : isom
minor_version : 1
compatible_brands: isom
creation_time : 2024-07-16T16:40:10.000000Z
encoder : Lavf60.3.100
Stream #0:0(und): Video: hevc (Main) (hvc1 / 0x31637668), yuv420p(tv, bt709), 8192x4096 [SAR 1:1 DAR 2:1], q=2-31, 59345 kb/s, 59.94 fps, 59.94 tbr, 60k tbn (default)
Metadata:
creation_time : 2024-07-16T16:40:10.000000Z
handler_name : ETI ISO Video Media Handler
vendor_id : [0][0][0][0]
encoder : HEVC Coding
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 320 kb/s (default)
Metadata:
creation_time : 2024-07-16T16:40:11.000000Z
handler_name : ETI ISO Audio Media Handler
vendor_id : [0][0][0][0]
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame= 0 fps=0.0 q=-1.0 size= 0kB time=-00:00:00.03 bitrate= -0.0kbits/s speed=N/A
[mp4 @ 00000156a81a2cc0] Starting second pass: moving the moov atom to the beginning of the file
frame= 1801 fps=0.0 q=-1.0 Lsize= 217511kB time=00:00:29.99 bitrate=59401.7kbits/s speed= 207x
video:216290kB audio:1173kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.021847%title:0kB other streams:0kB global headers:0kB muxing overhead: 0.021847%
possibly related #2518
from email (some assisted by AI):
Steps to reproduce
Only happens on some files.
Expected behavior
No corruption. Used to work in v3.64 (maybe?). Output file from v3.64 with ffprobe:
Actual behavior
Output is corrupted / unplayable (not sure what that means exactly). Output file from 3.67.1 gives error in ffprobe:
Cutting manually with ffmpeg to cut video works:
Without the AUD part or HEV1 it usually would not play:
Suggests AUD part is needed, and suspects this problem is about in-stream AUD handling and preserving. AI also initially sugested that old Losslesscut version is looking for keyframes to match more closely but I am not so sure.
Share log from developer tools
Original file ffprobe:
{ "streams": [ { "index": 0, "codec_name": "hevc", "codec_long_name": "H.265 / HEVC (High Efficiency Video Coding)", "profile": "Main", "codec_type": "video", "codec_tag_string": "hev1", "codec_tag": "0x31766568", "width": 8192, "height": 4096, "coded_width": 8192, "coded_height": 4096, "closed_captions": 0, "film_grain": 0, "has_b_frames": 2, "sample_aspect_ratio": "1:1", "display_aspect_ratio": "2:1", "pix_fmt": "yuv420p", "level": 183, "color_range": "tv", "color_space": "bt709", "color_transfer": "bt709", "color_primaries": "bt709", "chroma_location": "left", "refs": 1, "view_ids_available": "", "view_pos_available": "", "id": "0x1", "r_frame_rate": "60000/1001", "avg_frame_rate": "60000/1001", "time_base": "1/60000", "start_pts": 0, "start_time": "0.000000", "duration_ts": 164827663, "duration": "2747.127717", "bit_rate": "59345762", "nb_frames": "164663", "extradata_size": 23, "disposition": { "default": 1, "dub": 0, "original": 0, "comment": 0, "lyrics": 0, "karaoke": 0, "forced": 0, "hearing_impaired": 0, "visual_impaired": 0, "clean_effects": 0, "attached_pic": 0, "timed_thumbnails": 0, "non_diegetic": 0, "captions": 0, "descriptions": 0, "metadata": 0, "dependent": 0, "still_image": 0, "multilayer": 0 }, "tags": { "creation_time": "2024-07-16T16:40:10.000000Z", "language": "und", "handler_name": "ETI ISO Video Media Handler", "vendor_id": "[0][0][0][0]", "encoder": "\u000bHEVC Coding" } }, { "index": 1, "codec_name": "aac", "codec_long_name": "AAC (Advanced Audio Coding)", "profile": "LC", "codec_type": "audio", "codec_tag_string": "mp4a", "codec_tag": "0x6134706d", "sample_fmt": "fltp", "sample_rate": "48000", "channels": 2, "channel_layout": "stereo", "bits_per_sample": 0, "initial_padding": 0, "id": "0x2", "r_frame_rate": "0/0", "avg_frame_rate": "0/0", "time_base": "1/48000", "start_pts": 0, "start_time": "0.000000", "duration_ts": 131860928, "duration": "2747.102667", "bit_rate": "320000", "nb_frames": "128772", "extradata_size": 2, "disposition": { "default": 1, "dub": 0, "original": 0, "comment": 0, "lyrics": 0, "karaoke": 0, "forced": 0, "hearing_impaired": 0, "visual_impaired": 0, "clean_effects": 0, "attached_pic": 0, "timed_thumbnails": 0, "non_diegetic": 0, "captions": 0, "descriptions": 0, "metadata": 0, "dependent": 0, "still_image": 0, "multilayer": 0 }, "tags": { "creation_time": "2024-07-16T16:40:11.000000Z", "language": "eng", "handler_name": "ETI ISO Audio Media Handler", "vendor_id": "[0][0][0][0]" } } ], "chapters": [ ], "format": { "filename": "original.mp4", "nb_streams": 2, "nb_programs": 0, "nb_stream_groups": 0, "format_name": "mov,mp4,m4a,3gp,3g2,mj2", "format_long_name": "QuickTime / MOV", "start_time": "0.000000", "duration": "2747.127717", "size": "20494043301", "bit_rate": "59681370", "probe_score": 100, "tags": { "major_brand": "isom", "minor_version": "1", "compatible_brands": "isom", "creation_time": "2024-07-16T16:40:10.000000Z" } } }LosslessCut ffmpeg command: