mifi/lossless-cut

Cut video GoPro problem

Opened this issue · 26 comments

Hi, i have a problem. When I try to cut a video of my Gopro Hero 6, the cut video is the same length as the original but inside the new video, there is the clip cut and the remaining part is completely empty (black screen).

Video in 4k 30Fps, h.264, .mp4

Is possible share the video?

Thanks!

mifi commented

I don't quite understand your problem. You can share small files here, but if it's a big file I guess you have to use dropbox, google drive etc.

mifi commented

Something strange is happening when cutting your file, I don't know what it is. I get the same issue with ffmpeg directly. Maybe a future new version of ffmpeg will solve the issue. For now you can try to toggle the button kc to nc, it seems to be working then.

Ok, thank you so much for helping me !

I have the same issue with GoPro HERO7 Black, I went back to using 1.14.

I really need kc because of audio-desync issues when concatenating; nc just doesn't cut it :]

mifi commented

@bbsixzz why did you need to go back to v1.14? Doesn't v2 with nc work?

With 1.14 I cut using kc because nc gives me audio-desync issues, v2 kc gives me the same problem as @Chrispowa described above. After I cut my videos I usually concatenate the remaining pieces using ffWorks, I tried loading my last concatenated video in v2 to test if nc would give the same audio-desync issues as in 1.14 but ran into this problem instead:

screenshot 2019-02-11 at 01 15 32

Works fine editing in 1.14…

I ran into this and figured out a workaround for single clips at least. Haven't tried merging anything. But this command to remux an MP4 file to a web-optimized MP4 file fixed the issue for me:

ffmpeg -i sourcefile.mp4 -movflags faststart -c copy outfile.mp4

I have a Hero 6 Black, and this was on a 1080p/60fps clip.

I have the exact same problem.
Video from iPhone 5S, cut doesn't display icon on Windows or load in Microsoft's video players. Loads in VLC but shows incorrect time position (same as original video) but correct length.
Cut using kc on v2.1; nc works but gives audio desync on both v2.1 and v1.14; kc works perfectly on v1.14.

DGrv commented

Same problem with the GoPro Black 7.
The way I found to use the cut video afterwards by fixing this BUT (read later).

ffmpeg -err_detect ignore_err -i input.mp4 -c copy output.mp4

In a batch

for %%i in (*.mp4) do (
	ffmpeg -err_detect ignore_err -i %%i -c copy %%i.mp4
	del %%i
)

However the video can afterwards not being cut again (unknown format or codec combinaison).
It seems that it is removing some metadata

Original one:

Metadata:
  creation_time   : 2016-03-22T20:29:00.000000Z
  handler_name    : GoPro AVC
  encoder         : GoPro AVC encoder
  timecode        : 00:36:32:10
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 190 kb/s (default)
Metadata:
  creation_time   : 2016-03-22T20:29:00.000000Z
  handler_name    : GoPro AAC
Stream #0:2(eng): Data: none (tmcd / 0x64636D74), 0 kb/s (default)
Metadata:
  creation_time   : 2016-03-22T20:29:00.000000Z
  handler_name    : GoPro TCD
  timecode        : 00:36:32:10
Stream #0:3(eng): Data: bin_data (gpmd / 0x646D7067), 26 kb/s (default)
Metadata:
  creation_time   : 2016-03-22T20:29:00.000000Z
  handler_name    : GoPro MET
Stream #0:4(eng): Data: none (stts / 0x73747473), 6 kb/s (default)
Metadata:
  creation_time   : 2016-03-22T20:29:00.000000Z
  handler_name    : GoPro SOS

Output from the ffmpeg line above:

Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.20.100
Duration: 00:00:12.06, start: 0.000000, bitrate: 60630 kb/s
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709), 2704x1520 [SAR 1:1 DAR 169:95], 60436 kb/s, 59.94 fps, 59.94 tbr, 60k tbn, 119.88 tbc (default)
Metadata:
handler_name : GoPro AVC
timecode : 01:41:54:04
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 189 kb/s (default)
Metadata:
handler_name : GoPro AAC
Stream #0:2(eng): Data: none (tmcd / 0x64636D74), 0 kb/s
Metadata:
handler_name : GoPro AVC
timecode : 01:41:54:04

💯 For info : v1.11.0 is cuting everything perfectly without this problem. (did not try the other version).

Source here

DGrv commented

Cf #146 to resolve this with the actual version.

mifi commented

For those who have problem with cutting error, try latest version and set output format to MOV

Works fine when output format set to MOV.

However, auto merge when disabled outputs black video files.

When auto merge is enabled the output is without problems.

mifi commented

Could it be related to file extension? I see that when I choose mov format, the output file extension will still be the same as input (for example .mp4), maybe try to rename to .mov and see if it helps

It seems the normal cut fixes the issue and outputs all the segments correctly.

Keyframe cut works fine when single cutting however.

The black video actually plays fine using mpv although seeking is messed up.

QuickTime shows black video and no sound, although seeking works :)

I'm just happy I can finally cut and merge inside the app without having to export segments one by one using keyframe cut and then merging the files in ffworks. Right now the latest version is an improvement upon 1.14 which saves lots of time.

If however one would like to export the segments one by one normal cut isn't good enough because when merged there will be the aforementioned audio-desync issues.

So I guess that's the last problem to fix right now, excellent work so far :)

I did some further testing.

If I change the input from anything other than the start the output will be black (keyframe cut).

This explains why all the clips ended up black following my first cut starting from 00:00:00:000.

If however one would like to export the segments one by one normal cut isn't good enough because when merged there will be the aforementioned audio-desync issues.

I've been cutting everyting with normal cut lately and there have been no problems with audio-desync. There really isn't any reason to use keyframe cut now with GoPro footage, the precision with normal cut is much better. I either merge the clips with auto merge or by using the merge files tool. Works great, I'm a happy camper :]

The trick to make normal cut work is setting output streams to primary streams only.

pkamb commented

I recorded some VHS footage using Elgato Video Capture app on the Mac. Output is a .mp4 file.

  • kc Keyframe Cut works very poorly. Videos have black space recorded before the clip. Or the entire video is black. Only 4 out of my 12 clips get preview icons in macOS Finder. None of the videos play via Quick Look. Unusable.

  • nc Normal Cut seems to work well. No black videos. Finder preview thumbnail icons for all. Quick Look can play each video.

Mostly though I am afraid that I am losing frames of video when using the nc mode. Any frames between my cut and the next key frame... are they lost? The videos all seem to start with several frames of blank video, so I am afraid that either frames are being lost or the clips are not being trimmed where I set them to be cut.

Did you try setting output streams to primary streams only when using normal cut?

pkamb commented

@bbsixzz what would that do/fix? Normal Cut is almost working perfectly. What do the output streams do?

As per instructions from the dev:

  • all streams seems to cause wrong length in GoPro footage. Use ps instead. See #146 and #121

You should try it to see if it helps.

mifi commented

The code is now changed to only include audio, video and subtitle streams by default (can be overridden from the Tracks menu.) I think the problem here was that some files contain proprietary binary streams that ffmpeg cannot cut, thus when including those they would stay the same length as before cutting, causing the video to also stay the same length. I've tested with gopro 6/7 and now it seems to work with both keyframe cut and normal cut. Please test v3 to see if it has improved now. Note that we will now lose the proprietary data tracks tmcd, fdsc and gpmd, but I'm thinking how to best solve that problem. I'm thinking maybe we could export those as separate files next to the output video.

mifi commented

Now implemented auto export the extra streams as separate files

mifi commented

I think this can be closed