mifi / lossless-cut

The swiss army knife of lossless video/audio editing
https://losslesscut.app/
GNU General Public License v2.0
26.1k stars 1.26k forks source link

h265 v3.48.2 no video playback on ubuntu 20.04 / X11 / nvidia gpu #1407

Closed AhTeeGuu3u closed 1 year ago

AhTeeGuu3u 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

Steps to reproduce

Open the test.mp4 (created with davinci resolve)

Expected behavior

Display video

Actual behavior

Black preview frame

Provide an error report

No error occurred.

{ "state": { "filePath": "/home/dennis/Youtube/test.mp4", "fileFormat": "mp4", "externalFilesMeta": {}, "mainStreams": [ { "index": 0, "codec_name": "hevc", "codec_long_name": "H.265 / HEVC (High Efficiency Video Coding)", "profile": "Main", "codec_type": "video", "codec_tag_string": "hvc1", "codec_tag": "0x31637668", "width": 1920, "height": 1080, "coded_width": 1920, "coded_height": 1088, "closed_captions": 0, "film_grain": 0, "has_b_frames": 1, "sample_aspect_ratio": "1:1", "display_aspect_ratio": "16:9", "pix_fmt": "yuv420p", "level": 150, "color_range": "tv", "chroma_location": "left", "field_order": "progressive", "refs": 1, "id": "0x1", "r_frame_rate": "30/1", "avg_frame_rate": "30/1", "time_base": "1/15360", "start_pts": 0, "start_time": "0.000000", "duration_ts": 304128, "duration": "19.800000", "bit_rate": "2519867", "nb_frames": "594", "extradata_size": 130, "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, "captions": 0, "descriptions": 0, "metadata": 0, "dependent": 0, "still_image": 0 }, "tags": { "creation_time": "2022-12-26T23:44:43.000000Z", "language": "und", "handler_name": "VideoHandler", "vendor_id": "[0][0][0][0]", "timecode": "01:00:00:00" } }, { "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, "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": 951296, "duration": "19.818667", "bit_rate": "196071", "nb_frames": "929", "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, "captions": 0, "descriptions": 0, "metadata": 0, "dependent": 0, "still_image": 0 }, "tags": { "creation_time": "2022-12-26T23:44:43.000000Z", "language": "und", "handler_name": "SoundHandler", "vendor_id": "[0][0][0][0]" } }, { "index": 2, "codec_type": "data", "codec_tag_string": "tmcd", "codec_tag": "0x64636d74", "id": "0x3", "r_frame_rate": "0/0", "avg_frame_rate": "15360/512", "time_base": "1/15360", "start_pts": 0, "start_time": "0.000000", "duration_ts": 304128, "duration": "19.800000", "bit_rate": "1", "nb_frames": "1", "extradata_size": 20, "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": { "creation_time": "2022-12-26T23:44:43.000000Z", "language": "eng", "handler_name": "TimeCodeHandler", "timecode": "01:00:00:00" } } ], "copyStreamIdsByFile": { "/home/dennis/Youtube/test.mp4": { "0": true, "1": true, "2": false } }, "cutSegments": [ {} ], "mainFileFormatData": { "filename": "/home/dennis/Youtube/test.mp4", "nb_streams": 3, "nb_programs": 0, "format_name": "mov,mp4,m4a,3gp,3g2,mj2", "format_long_name": "QuickTime / MOV", "start_time": "0.000000", "duration": "19.800000", "size": "6731194", "bit_rate": "2719674", "probe_score": 100, "tags": { "major_brand": "isom", "minor_version": "512", "compatible_brands": "isomiso2mp41", "creation_time": "2022-12-26T23:44:43.000000Z", "encoder": "Blackmagic Design DaVinci Resolve" } }, "rotation": 360, "shortestFlag": false, "effectiveExportMode": "separate" }, "platform": "linux", "version": "3.48.2" }

Share the file

https://drive.google.com/file/d/1E8WGCYPjmCyl9KWnV2c8tebBcgJ-qQnP/view?usp=sharing

Share log

index.jsx:14 Version 3.48.2 ffmpeg.js:61 ffmpeg -hide_banner -f lavfi -i 'nullsrc=s=256x256:d=1' -f null - App.jsx:1908 userOpenFiles App.jsx:1909 /home/dennis/Youtube/test.mp4 App.jsx:1511 loadMedia /home/dennis/Youtube/test.mp4 /home/dennis/Videos undefined App.jsx:1515 state reset ffmpeg.js:46 ffprobe -of json -show_chapters -show_format -show_entries stream -i '/home/dennis/Youtube/test.mp4' -hide_banner ffmpeg.js:275 formats mov,mp4,m4a,3gp,3g2,mj2 ffmpeg.js:267 fileType detected format {"ext":"mp4","mime":"video/mp4"} App.jsx:639 onDurationChange 19.818667 ffmpeg.js:46 ffprobe -v error -read_intervals '0%30' -show_packets -select_streams 0 -show_entries 'packet=pts_time,flags' -of json '/home/dennis/Youtube/test.mp4' ffmpeg.js:46 ffprobe -v error -read_intervals '0%35.444944' -show_packets -select_streams 0 -show_entries 'packet=pts_time,flags' -of json '/home/dennis/Youtube/test.mp4' DevTools failed to load source map: Could not parse content for file:///home/dennis/Binaries/LosslessCut-linux-x64/resources/app.asar/node_modules/cue-parser/lib/cue.js.map: Unexpected end of JSON input DevTools failed to load source map: Could not parse content for file:///home/dennis/Binaries/LosslessCut-linux-x64/resources/app.asar/node_modules/cue-parser/lib/cuesheet.js.map: Unexpected end of JSON input DevTools failed to load source map: Could not parse content for file:///home/dennis/Binaries/LosslessCut-linux-x64/resources/app.asar/node_modules/cue-parser/lib/command.js.map: Unexpected end of JSON input

mifi commented 1 year ago

Assuming it works in older versions. See discussion in #88

AhTeeGuu3u commented 1 year ago

@mifi thanks, read this. it works native on windows, hope linux support can be made possible.

mifi commented 1 year ago

Native support depends on having hardware decoder support as well as a decoding stack that chromium supports i think. So if h265 works in chromium on your computer then it should also work in losslesscut i think

AhTeeGuu3u commented 1 year ago

Have read around the internet, h265 is indeed a problem on Linux....how shouldn't it be? :).

Here is demo code, which also detects if h265 is supported, lossless cut could fall back automatically https://codepen.io/cloudunder/post/hevc-html5-video

This embedded chrome player is able to play the test video, it uses libde265 to display it: https://chrome.google.com/webstore/detail/h265-hevc-player/dambgipgbnhmnkdolkljibpcbocimnpd/related

Pure JavaScript HEVC/H.265 video decoding library using libde265. https://github.com/strukturag/libde265.js

Wasm libde265 and libopus decoders for web https://github.com/adminy/wasm-codecs

mifi commented 1 year ago

Do you see any onVideoError in the developer tools log after pressing "play" when you get a black screen?

AhTeeGuu3u commented 1 year ago

i get only this wehn hitting play ffprobe -v error -read_intervals '0%37.700091' -show_packets -select_streams 0 -show_entries 'packet=pts_time,flags' -of json 'test.mp4'

ffplay works, so the system should be able to play it. Maybe this helps? Simple video player using electron & ffplay (as node addon) https://github.com/stevevista/electron-ffplay

mifi commented 1 year ago

If you Convert to supported format from the file menu, does it work then?

mifi commented 1 year ago

I think it's the same issue as #595 #975 - e.g. that chromium doesn't report an error if the codec is hevc, and will only play the audio and black video. Will fix it by adding a check using navigator.mediaCapabilities.decodingInfo