comchap icon indicating copy to clipboard operation
comchap copied to clipboard

Chapter end time before start

Open MrTschi opened this issue 7 years ago • 7 comments

Comskip generated the following /recordings/movie.edl:

0.00	739.92	0
3502.08	3698.60	0
5162.68	5350.08	0

I feeded it into Comchap with command: /home/comchap/comchap --ffmpeg=/usr/bin/ffmpeg --comskip=/usr/bin/comskip --keep-edl --keep-meta /recordings/movie.mkv

This generates the /recordings/movie.ffmeta

;FFMETADATA1
[CHAPTER]
TIMEBASE=1/1000
START=0
END=3502080
title=Chapter 1
[CHAPTER]
TIMEBASE=1/1000
START=3502080
END=3698600
title=Commercial 1
[CHAPTER]
TIMEBASE=1/1000
START=3698600
END=0
title=Chapter 2
[CHAPTER]
TIMEBASE=1/1000
START=0
END=0
title=Commercial 2
[CHAPTER]
TIMEBASE=1/1000
START=0
END=6179950
title=Chapter 3

... and then Comchap crashes with message:

[ffmetadata @ 0x74a36030] Chapter end time 0 before start 3698600
/recordings/movie.ffmeta: Out of memory
Error running ffmpeg: /recordings/movie.mkv

RAM may not the issue, there is a lot of free memory..

Maybe this part of the .ffmeta is corrupt?

...
[CHAPTER]
TIMEBASE=1/1000
START=3698600
END=0
title=Chapter 2
...

System information Raspberry Pi 3 (armhf) awk: BusyBox v1.26.2 (2017-06-11 06:38:58 GMT) multi-call binary. Comskip 0.81.098, made using ffmpeg Comchap master (d52aa367d369652f0a0dcd638ab46d35095f7a42)

MrTschi avatar Nov 20 '17 19:11 MrTschi

The ffmeta file definitely doesn't look right and more than likely is the reason to the failure.

I don't know what could have happened to generate that ffmeta file from the edl file posted as it appears to be skipping at least one entry. When I get time I'll try to replicate and fix.

BrettSheleski avatar Nov 21 '17 02:11 BrettSheleski

I had the same problem - but discovered that it was due to spaces vs tabs. make sure your edl file is using tabs between the entries on each line

yajrendrag avatar Jan 13 '18 01:01 yajrendrag

I am experiencing this problem. I checked my edl file and it has tabs. Here is the error:

[ffmetadata @ 0x7fcb57820600] Chapter end time 9000030 before start 9000230
/Volumes/Movies/movie.ffmeta: Cannot allocate memory
0	39.11	3
1260.53	1480.65	3
2166.7	2446.85	3
3049.55	3314.61	3
3981.68	4186.89	3
4780.58	5000.8	3
5839.1	6118.75	3
6793.76	7003.97	3
7805.67	9000.23	3

arejay73 avatar Apr 17 '19 15:04 arejay73

I was able to reproduce the ffmeta file for the previous edl file. You can see the last chapter is the one giving problems.

0	21.92	3
891.19	1145.18	3
1844.41	2009.51	3
2824.09	3109.27	3
3764.76	4124.85	3
4901	5186.18	3
5928.39	6213.57	3
6906.7	7199.52	3
;FFMETADATA1
[CHAPTER]
TIMEBASE=1/1000
START=0
END=0
title=Chapter 1
[CHAPTER]
TIMEBASE=1/1000
START=0
END=21920
title=Commercial 1
[CHAPTER]
TIMEBASE=1/1000
START=21920
END=891190
title=Chapter 2
[CHAPTER]
TIMEBASE=1/1000
START=891190
END=1145180
title=Commercial 2
[CHAPTER]
TIMEBASE=1/1000
START=1145180
END=1844410
title=Chapter 3
[CHAPTER]
TIMEBASE=1/1000
START=1844410
END=2009510
title=Commercial 3
[CHAPTER]
TIMEBASE=1/1000
START=2009510
END=2824090
title=Chapter 4
[CHAPTER]
TIMEBASE=1/1000
START=2824090
END=3109270
title=Commercial 4
[CHAPTER]
TIMEBASE=1/1000
START=3109270
END=3764760
title=Chapter 5
[CHAPTER]
TIMEBASE=1/1000
START=3764760
END=4124850
title=Commercial 5
[CHAPTER]
TIMEBASE=1/1000
START=4124850
END=4901000
title=Chapter 6
[CHAPTER]
TIMEBASE=1/1000
START=4901000
END=5186180
title=Commercial 6
[CHAPTER]
TIMEBASE=1/1000
START=5186180
END=5928390
title=Chapter 7
[CHAPTER]
TIMEBASE=1/1000
START=5928390
END=6213570
title=Commercial 7
[CHAPTER]
TIMEBASE=1/1000
START=6213570
END=6906700
title=Chapter 8
[CHAPTER]
TIMEBASE=1/1000
START=6906700
END=7199520
title=Commercial 8
[CHAPTER]
TIMEBASE=1/1000
START=7199520
END=7199300
title=Chapter 9

arejay73 avatar Apr 17 '19 23:04 arejay73

It looks like Comskip is producing a chapter with an end time after the total end time of the video. It should be a simple fix to account for this case.

BrettSheleski avatar Apr 18 '19 00:04 BrettSheleski

Do you know what might cause this? I was assuming that the script is looking at the EDL file, which exists, and then computing the ffmeta file. I think my edl file looks correct, so maybe something in the logic calculation?

arejay73 avatar Apr 18 '19 13:04 arejay73

It looks like Comskip is producing a chapter with an end time after the total end time of the video. It should be a simple fix to account for this case.

I am working also at the "problem" to write chapters with ffmpeg and it was also the same issue why I got a memory error (wrong end time of last chapter)

rokdd avatar Aug 03 '21 16:08 rokdd