mifi / lossless-cut

The swiss army knife of lossless video/audio editing
GNU General Public License v2.0
24.85k stars 1.22k forks source link

TS file : Moving Frame by Frame needs several clicks before seeing an effect #1583

Closed AlexBelz closed 6 months ago

AlexBelz commented 1 year ago

I have a lot of issues to go through, so in order to make it easier for me to help you, I ask that you please try these things first

Operating System

Windows 10

Steps to reproduce

Hi, I'm new ot LossLessCut. I've searched for answers on existing doc & FAQ, without success.

Steps :

  1. Open a TS file (HD MPEG4 ; from CGV DVB-T Etimo recorder)
  2. move forward by 1 frame. Nothing changes. Press it multiple time ; after several moves (typ. 12-16) the picture changes.
  3. Pressing previous frame goes to the previous picture.

I used Fastest preview, is it the reason ? (only some pictures are rendered ?) Tryed to transcode "full", but it's too slow before I can work on my TS file. Some other TS cutting tool succeed to display this TS file frame by frame without reencoding, so I believe it's not due to the TS file itself.

Expected behavior

A press on Next Frame should display the next frame, even if preview is slow.

Actual behavior

Only some frames are rendered/previewed. the others are identical (not frame by frame preview).

Share log

No error occurred.

{ "state": { "ffmpegExperimental": false, "preserveMovData": false, "movFastStart": true, "preserveMetadataOnMerge": true, "filePath": "D:\Videos\[TS]2023-01-03.20.58.09 Ready Player One\TS LossLessCut\000-merged-1673007618874.ts", "fileFormat": "mpegts", "externalFilesMeta": {}, "mainStreams": [ { "index": 0, "codec_name": "bin_data", "codec_long_name": "binary data", "codec_type": "data", "codec_tag_string": "[6][0][0][0]", "codec_tag": "0x0006", "id": "0x100", "r_frame_rate": "0/0", "avg_frame_rate": "0/0", "time_base": "1/90000", "start_pts": 126000, "start_time": "1.400000", "duration_ts": 1464081804, "duration": "16267.575600", "disposition": { "default": 0, "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, "captions": 0, "descriptions": 0, "metadata": 0, "dependent": 0, "still_image": 0 } }, { "index": 1, "codec_name": "h264", "codec_long_name": "H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10", "profile": "High", "codec_type": "video", "codec_tag_string": "[27][0][0][0]", "codec_tag": "0x001b", "width": 1920, "height": 1080, "coded_width": 1920, "coded_height": 1080, "closed_captions": 0, "film_grain": 0, "has_b_frames": 3, "sample_aspect_ratio": "1:1", "display_aspect_ratio": "16:9", "pix_fmt": "yuv420p", "level": 40, "color_range": "tv", "color_space": "bt709", "color_transfer": "bt709", "color_primaries": "bt709", "chroma_location": "left", "field_order": "tt", "refs": 1, "is_avc": "false", "nal_length_size": "0", "id": "0x101", "r_frame_rate": "25/1", "avg_frame_rate": "25/1", "time_base": "1/90000", "start_pts": 323436, "start_time": "3.593733", "duration_ts": 1463761812, "duration": "16264.020133", "bits_per_raw_sample": "8", "extradata_size": 111, "disposition": { "default": 0, "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, "captions": 0, "descriptions": 0, "metadata": 0, "dependent": 0, "still_image": 0 } }, { "index": 2, "codec_name": "eac3", "codec_long_name": "ATSC A/52B (AC-3, E-AC-3)", "codec_type": "audio", "codec_tag_string": "EAC3", "codec_tag": "0x33434145", "sample_fmt": "fltp", "sample_rate": "48000", "channels": 2, "channel_layout": "stereo", "bits_per_sample": 0, "id": "0x102", "r_frame_rate": "0/0", "avg_frame_rate": "0/0", "time_base": "1/90000", "start_pts": 128880, "start_time": "1.432000", "duration_ts": 1463944128, "duration": "16266.045867", "bit_rate": "128000", "disposition": { "default": 0, "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, "captions": 0, "descriptions": 0, "metadata": 0, "dependent": 0, "still_image": 0 }, "tags": { "language": "fra" } }, { "index": 3, "codec_name": "eac3", "codec_long_name": "ATSC A/52B (AC-3, E-AC-3)", "codec_type": "audio", "codec_tag_string": "EAC3", "codec_tag": "0x33434145", "sample_fmt": "fltp", "sample_rate": "48000", "channels": 2, "channel_layout": "stereo", "bits_per_sample": 0, "id": "0x103", "r_frame_rate": "0/0", "avg_frame_rate": "0/0", "time_base": "1/90000", "start_pts": 128880, "start_time": "1.432000", "duration_ts": 1463955648, "duration": "16266.173867", "bit_rate": "128000", "disposition": { "default": 0, "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, "captions": 0, "descriptions": 0, "metadata": 0, "dependent": 0, "still_image": 0 }, "tags": { "language": "qaa" } }, { "index": 4, "codec_name": "eac3", "codec_long_name": "ATSC A/52B (AC-3, E-AC-3)", "codec_type": "audio", "codec_tag_string": "EAC3", "codec_tag": "0x33434145", "sample_fmt": "fltp", "sample_rate": "48000", "channels": 2, "channel_layout": "stereo", "bits_per_sample": 0, "id": "0x104", "r_frame_rate": "0/0", "avg_frame_rate": "0/0", "time_base": "1/90000", "start_pts": 126000, "start_time": "1.400000", "duration_ts": 1464078204, "duration": "16267.535600", "bit_rate": "96000", "disposition": { "default": 0, "dub": 0, "original": 0, "comment": 0, "lyrics": 0, "karaoke": 0, "forced": 0, "hearing_impaired": 0, "visual_impaired": 1, "clean_effects": 0, "attached_pic": 0, "timed_thumbnails": 0, "captions": 0, "descriptions": 1, "metadata": 0, "dependent": 0, "still_image": 0 }, "tags": { "language": "fra" } }, { "index": 5, "codec_name": "dvb_subtitle", "codec_long_name": "DVB subtitles", "codec_type": "subtitle", "codec_tag_string": "[6][0][0][0]", "codec_tag": "0x0006", "id": "0x105", "r_frame_rate": "0/0", "avg_frame_rate": "0/0", "time_base": "1/90000", "start_pts": 337836, "start_time": "3.753733", "duration_ts": 1463909568, "duration": "16265.661867", "extradata_size": 5, "disposition": { "default": 0, "dub": 0, "original": 0, "comment": 0, "lyrics": 0, "karaoke": 0, "forced": 0, "hearing_impaired": 1, "visual_impaired": 0, "clean_effects": 0, "attached_pic": 0, "timed_thumbnails": 0, "captions": 0, "descriptions": 0, "metadata": 0, "dependent": 0, "still_image": 0 }, "tags": { "language": "fra" } }, { "index": 6, "codec_name": "dvb_subtitle", "codec_long_name": "DVB subtitles", "codec_type": "subtitle", "codec_tag_string": "[6][0][0][0]", "codec_tag": "0x0006", "id": "0x106", "r_frame_rate": "0/0", "avg_frame_rate": "0/0", "time_base": "1/90000", "start_pts": 126000, "start_time": "1.400000", "duration_ts": 1464121404, "duration": "16268.015600", "extradata_size": 5, "disposition": { "default": 0, "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, "captions": 0, "descriptions": 0, "metadata": 0, "dependent": 0, "still_image": 0 }, "tags": { "language": "fra" } } ], "copyStreamIdsByFile": { "D:\Videos\[TS]2023-01-03.20.58.09 Ready Player One\TS LossLessCut\000-merged-1673007618874.ts": { "0": false, "1": true, "2": true, "3": false, "4": false, "5": true, "6": false } }, "cutSegments": [ { "start": 520.033733, "end": 8486.240667 } ], "mainFileFormatData": { "filename": "D:\Videos\[TS]2023-01-03.20.58.09 Ready Player One\TS LossLessCut\000-merged-1673007618874.ts", "nb_streams": 7, "nb_programs": 1, "format_name": "mpegts", "format_long_name": "MPEG-TS (MPEG-2 Transport Stream)", "start_time": "1.400000", "duration": "16268.015600", "size": "9547901292", "bit_rate": "4695299", "probe_score": 50 }, "rotation": 360, "shortestFlag": false, "effectiveExportMode": "separate", "outSegTemplate": "${FILENAME}-${CUT_FROM}-${CUT_TO}${SEG_SUFFIX}${EXT}" }, "platform": "win32", "version": "3.54.0" }

mifi commented 1 year ago

hi does it work if you try to first remux to another format? or you can try convert to supported format: Fast: Full quality remux (no audio), likely to fail

Dean-Corso commented 1 year ago

Hi,

info: you should better not trying to edit any mpeg ts files in LC. I tried it with many tests and the output results you can forget. Would be nice if you @mifi would test to edit some TS files in your own app to see what you get. Problem seems to be ffmpeg itself so I get same bad results when trying to edit TS files with ffmpeg. If you wanna use LC to edit TS files then you should change the TS to mp4 container. I know it's again a bad detour but LC is not perfect yet.

@mifi, just test some TS files and edit / output them. All in all you can forget it. You should find a way to handle TS files similar as AviDemux can do so that your edits are not for the trashcan. The TS edits using ffmpeg is failing, unfortunately. In case of using LC you also don't get any audio wave form to see for TS files and you just can hear the sound only whats also an disadvantage of course. Also try to cut any TS file by keyframe cut method and select any KF inside of the video and then output it with an mp4 container and check the results which is buggy. All in all I can say, keep your hands of trying to edit TS files in LC and put them into a better manageable container ffmpeg can edit.

The slow reaction time if you try to seek for / backward or frame by frame is also a problem what does prevent having a good workflow (any video format). This you should try to improve if possible to get an 1:1 real time results at the end like you have in other editors too.

AlexBelz commented 1 year ago

Hi @mifi,

When I try to convert to Fast: Full quality remux (no audio), likely to fail

I get : Failed to convert file. Try a different conversion.

Back to fastest conversion, please find below some screen capture with max Zoom, around the beginning of a film. https://1drv.ms/f/s!Ahp2yXCYf8Wmnj6WqLvbcFonMUXp?e=rfVXYA You'll see that :

  1. thumbnails are only available on a few pictures, not even matching the "key frame" positions (white bars).
  2. When I move forward/backward by 1 frame only, the previewed picture does not change unless I get closer to another keyframe picture (example with "frame-1") . In between, the previewed frame does not change (frame = frame+1 = frame+N). That prevents any frame-accurate I/O setting.

I'll now try "slow transcode" for preview and see if all pictures are viewable as preview to get frame-accurate edition. (but that is a really slooooowwww preliminary step !).

AlexBelz commented 1 year ago

Hi @Dean-Corso , thank you for your experience feedback. I hope we'll be able to sort out this issue and continue working with TS files. In the meanwhile, I will try & export first in mp4, then do the cutting edition.

AlexBelz commented 1 year ago

Hi @mifi , converting to "Slow: Low quality encode (no audio)" solves my issue. I get a "...html5ified-slow.mkv" created and then Lossless Cut succeeds to display every frame. (but I need a large amount of time to get it done before I can start working).

I'm just surprised that we need to convert a TS before actually starting reading it frame by frame.

@mifi, do you consider it is normal, or a bug ? Do you want to get a portion of such a TS file to understand the issue ?

Best regards,

mifi commented 1 year ago

Hi. the problem is that losslesscut uses html5 video player, which does not support TS. However it does support h264/h265 etc, so it works when remuxing from ts to mp4 first. I think it could make sense to auto-convert TS files with h264 to "Slow: Low quality encode (no audio)". In the future.

I plan on implementing some improvements to this in the future, so this will not be necessary. However I haven't yet found a definite solution: #88

AlexBelz commented 1 year ago

Hi @Dean-Corso & @mifi I tried to export my project to mp4, but this fails if I want to keep the DVB subtitle track. If I remove subtitle track, mp4 export succeeds. Is it a known limitation of mp4 formats ?

mifi commented 1 year ago

mp4 doesn't support DVB subtitles. I think DVB subtitles are images (bitmaps). mp4 only supports a few text-based subtitles.

mifi commented 1 year ago

I found something: https://flussonic.com/doc/live-streaming/converting-dvb-subtitles-to-webvtt/ - maybe you could do something like this to convert the subtitle file. then after converted, you can re-import it into the mp4 as an extra track

AlexBelz commented 1 year ago

Thank you @mifi, I would like to stay inside LossLessCut, for workflow simplicity and player compatibility. For the moment I'll stay with the export of TS wrapped file, as it allows several audio languages and several DVB-Subtitles (bitmaps, you're right).

I'm eager to have LossLess cut supporting natively frame-by-frame preview and SmartCut of TS file ! :)

mifi commented 6 months ago

I've created a new overview issue for MPEG TS related problems: #1839 - I will close this issue because there isn't any obvious actionable solution.