mifi / lossless-cut

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

Support timecodes #506

Open mifi opened 3 years ago

mifi commented 3 years ago

Timecode can be embedded in a file.

Possible features

Separate stream

For example in GoPros

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

Other example:

Stream #0:2(und): Data: none (rtmd / 0x646D7472), 736 kb/s (default)
Metadata:
  creation_time   : 2019-10-15T12:06:02.000000Z
  handler_name    : Timed Metadata Media Handler
  timecode        : 00:13:17:24

Inside video stream

See example files from this site

ffprobe -v error -show_frames -of json tc_25fps_01min.m2v | grep timecode

"side_data_type": "GOP timecode",
"timecode": "00:00:00:00"
"side_data_type": "GOP timecode",
"timecode": "00:00:00:10"
...

Separate audio track

Timecodes can also be a separate audio track with a special LTC encoded sound. See libltc

Timvrakas commented 2 years ago

I'm trying to ingest a bunch of GoPro video, which has a built in timecode. When I trim the video, it still shows the same starting timecode, even though the start of the clip has changed. Am I doing something wrong, or is this still a WIP?

mifi commented 2 years ago

probably a shortcoming in ffmpeg. you could try with ffmpeg v5 and see if it's fixed

alinsavix commented 2 years ago

It looks like ffmpeg definitely does the wrong thing here (tested with 5.0), but it might be worth considering calculating the appropriate timecode for a given cut and adjusting it automatically when calling ffmpeg to do its thing. It would be a -very- useful feature.

mifi commented 1 year ago

I wonder if ffmpeg ignores timecode when cutting only for some files or all files

arielreyes001 commented 3 months ago

I'm unsure if I'm understanding correctly, but I think i am, and I'm wondering if it's the issue i was going to ask about:

Is it possible to preserve the timecode present in the file, and offset based on the segments? If it's possible, I'm not sure teh right settings because when I export the timecode is not present in the new files.

The files are wav files from a tentacle sync track e. Can provide one if necessary...

mifi commented 3 months ago

I believe you're asking for https://github.com/mifi/lossless-cut/issues/506#issuecomment-1224917375

Haven't done much testing but I think you would have to manually offset the timecode using the Tag editor on the video track

alinsavix commented 3 months ago

@arielreyes001 For the first part of your question -- yeah, that's what this ticket is about. Having timecode be correct when a file is cut into segments. Which is a feature I'd still really love to see (and wish I had the time/energy to implement myself).

For the second part of your question -- I'm not super familiar with tentacle sync, but don't the wav files from their stuff consist of one channel of actual audio, and one channel of timecode? Assuming I'm right about that, those files should just work w.r.t. timecode, no matter how they're cut, because that second audio channel always has the appropriate timecode for a given segment of audio encoded in it. If you're not seeing that, maybe your editor is only looking at timecode in the file's metadata (which ffmpeg just copies over when the files are cut) rather than the actual timecode encoded in the audio track?

arielreyes001 commented 3 months ago

@alinsavix

Oh, I see 😊 thanks, I was wondering if I Understood correctly.

Regarding the tentacles. There are two devices. The tentacle SYNC e will record an audio track onto one of the channels of a camera when plugged into it. The tentacle TRACK e, which is what i have, just records one mono track with the timecode metadata embedded into it. I don’t believe there’s a second track is recorded. At least as far as I can tell. Thanks for taking the time!