Comments (18)
This is how my edl file looks like:
0.97 4.87 0
118.95 246.85 0
732.20 1001.77 0
1639.24 1815.38 0
1841.14 1859.19 0
I've changed the start chapter from 0.97 to 1.00 and now comcut works fine. We need to fix the logic because it was dropping the 0 and generating the ffmeta chapter as .97 instead of 0.97.
I have no idea how to do that though.
from comchap.
Could you test to see if the .ffmeta file has 0.97 instead of .97 (include leading zero) if ffmpeg accepts the metadata file?
If so, then it should be an easy fix to make sure comcut includes a leading zero.
from comchap.
No, the .ffmeta has .97, while the edl that comskip generates has the proper 0.97.
from comchap.
Here are the .edl and the .ffmeta:
0.97 4.87 0
118.95 246.85 0
732.20 1001.77 0
1639.24 1815.38 0
1841.14 1859.19 0
;FFMETADATA1
[CHAPTER]
TIMEBASE=1/1
START=0
END=.97
[CHAPTER]
TIMEBASE=1/1
START=.97
END=115.05
[CHAPTER]
TIMEBASE=1/1
START=115.05
END=600.40
[CHAPTER]
TIMEBASE=1/1
START=600.40
END=1237.87
[CHAPTER]
TIMEBASE=1/1
START=1237.87
END=1263.63
from comchap.
I guess I wasn't clear. Could you update the ffmeta file with the leading zero and run that into ffmpeg specifying it as the metadata file and see if that works?
from comchap.
Yes, it works.
from comchap.
K, good. Should be an easy fix then.
from comchap.
Just added a commit to handle this. Give it a shot.
from comchap.
Did not work. Here is the error:
ffmpeg version 3.2-1~16.04.york1 Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 5.4.1 (Ubuntu 5.4.1-3ubuntu1~ubuntu16.04.1york0) 20161019
configuration: --prefix=/usr --extra-version='1~16.04.york1' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-libtesseract --disable-stripping --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libebur128 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librubberband --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-opengl --enable-sdl2 --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-openal --enable-frei0r --enable-libopencv --enable-libx264 --enable-chromaprint --enable-shared
libavutil 55. 34.100 / 55. 34.100
libavcodec 57. 64.100 / 57. 64.100
libavformat 57. 56.100 / 57. 56.100
libavdevice 57. 1.100 / 57. 1.100
libavfilter 6. 65.100 / 6. 65.100
libavresample 3. 1. 0 / 3. 1. 0
libswscale 4. 2.100 / 4. 2.100
libswresample 2. 3.100 / 2. 3.100
libpostproc 54. 1.100 / 54. 1.100
Input #0, ffmetadata, from 'The Big Bang Theory (2007) - S10E09 - The Geology Elevation.ffmeta':
Duration: 00:21:03.00, start: 0.000000, bitrate: 0 kb/s
Chapter #0:0: start 0.000000, end 0.000000
Chapter #0:1: start 0.000000, end 115.000000
Chapter #0:2: start 115.000000, end 600.000000
Chapter #0:3: start 600.000000, end 1238.000000
Chapter #0:4: start 1238.000000, end 1263.000000
concat:The Big Bang Theory (2007) - S10E09 - The Geology Elevation.part-1.ts|The Big Bang Theory (2007) - S10E09 - The Geology Elevation.part-2.ts|The Big Bang Theory (2007) - S10E09 - The Geology Elevation.part-3.ts|The Big Bang Theory (2007) - S10E09 - The Geology Elevation.part-4.ts|The Big Bang Theory (2007) - S10E09 - The Geology Elevation.part-5.ts: No such file or directory
rm: cannot remove 'The Big Bang Theory (2007) - S10E09 - The Geology Elevation.part-1.ts': No such file or directory
root@plex:/plex/tmp#
Here is the generated .ffmeta:
;FFMETADATA1
[CHAPTER]
TIMEBASE=1/1
START=0.000000
END=0.970000
[CHAPTER]
TIMEBASE=1/1
START=0.970000
END=115.050000
[CHAPTER]
TIMEBASE=1/1
START=115.050000
END=600.370000
[CHAPTER]
TIMEBASE=1/1
START=600.370000
END=1238.080000
[CHAPTER]
TIMEBASE=1/1
START=1238.080000
END=1263.840000
If I manually change the 0.97 value on the edl file to 1.0, the script works just fine.
from comchap.
Well it looks like I'll have to revert the last commit.
I thought you had said that when you added the leading zero to the ffmeta file things worked fine.
I want to avoid adding arbitrary rounding because things like that usually come back to haunt you.
I'll have to actually do some of my own testing to get this working.
from comchap.
I suspect this has to do with ffmpeg reading the START and END times in the metadata file as integer values.
I've done some testing with changing the TIMEBASE to 1/1000 and multiplying the START and END times by 1000 and things seem to work. However for some reason multiplying the start and end times in the script is causing the end time to not be written to the metadata file.
Once I figure this out I'll commit the change and you can confirm.
from comchap.
Yep, the ffmpeg documentation confirmes the above. It states that START and END must be integer values.
https://www.ffmpeg.org/ffmpeg-all.html#Metadata-1
That would explain why the decimal portion gets ignored.
from comchap.
Turns out it wasn't just the metadata file. When making temp files for each chapter it needs to specify the start time and duration of each part. Apparently that needs have a leading zero for durations less than 1 second.
from comchap.
Playing around with this. I used the multiply by 1000 method and it seems to work for my example:
- Change the timebase:
echo TIMEBASE=1/1000 >> "$metafile"
- Modify end and startnext:
end=`awk -vp="${line[0]}" 'BEGIN{printf "%.0f" ,p*1000}'`
startnext=`awk -vp="${line[1]}" 'BEGIN{printf "%.0f" ,p*1000}'`
- Modify the last end:
echo END=`$ffmpegPath -i "$infile" 2>&1 | grep Duration | awk '{print $2}' | tr -d , | awk -F: '{ print ($1*3600)+($2*60)+$3 }'| awk '{printf "%.0f",$1*1000}'` >> "$metafile"
Before and after diff of the .edl files:
3c3
< TIMEBASE=1/1
---
> TIMEBASE=1/1000
5c5
< END=0.00
---
> END=0
8,10c8,10
< TIMEBASE=1/1
< START=0.00
< END=7.37
---
> TIMEBASE=1/1000
> START=0
> END=7370
13,15c13,15
< TIMEBASE=1/1
< START=7.37
< END=97.06
---
> TIMEBASE=1/1000
> START=7370
> END=97060
18,20c18,20
< TIMEBASE=1/1
< START=97.06
< END=250.18
---
> TIMEBASE=1/1000
> START=97060
> END=250180
23,25c23,25
< TIMEBASE=1/1
< START=250.18
< END=600.1
---
> TIMEBASE=1/1000
> START=250180
> END=600100
Works for this one example. Is this the same method you used? What issue did you see?
from comchap.
Take a look at the code commit, it's all in there.
In comcut it was already doing the math by piping to bc. I just added a multiply factor of 1000 in there.
echo START=`echo "($start - $totalcutduration) * 1000" | bc | awk '{printf "%i", $0}'` >> "$metafile"
echo END=`echo "($end - $totalcutduration) * 1000" | bc | awk '{printf "%i", $0}'` >> "$metafile"
I then added this to comchap similarly in this commit.
echo START=`echo "$end * 1000" | bc | awk '{printf "%i", $0}'`>> "$metafile"
echo END=`echo "$startnext * 1000" | bc | awk '{printf "%i", $0}'`>> "$metafile"
In both cases I'm then piping to awk to format the string as an integer. The only real advantage this does is if the START or END times are less than 1 it avoids a value starting with a decimal point.
The real problem with this bug, as it turns out, was not this. It had to do with the duration for chapters less than a second long and ffmpeg apparently needing a leading zero before the decimal point. Awk again took care of this by formatting the value as a floating point value. See this commit
duration=`echo "$end" - "$start" | bc | awk '{printf "%f", $0}'`
from comchap.
Since you are already using awk, I'd recommend using it for the math as well. 'bc' isn't installed by default everywhere, whereas I believe awk is more universal. On my Ubuntu server 16.04, 'bc' wasn't installed by default.
from comchap.
Sounds like a good idea. I lifted using bc
from some other inspirational script anyway. If you are feeling inspired, feel free to create a pull request resolving this. I likely won't be able to get to it for a few days.
from comchap.
Sure I'll do it later this evening. I already worked out a working example.
from comchap.
Related Issues (20)
- Permission to Distribute HOT 2
- Comcut break if no Commercials HOT 6
- Chapter end time before start HOT 7
- handbrakecli post-processing HOT 3
- comcut output file is huge HOT 2
- H.264 bitstream malformed, no startcode found HOT 5
- awk command needs an extra space
- XML based chapter file could allow automatic skipping of commercial chapters HOT 1
- comcut breaks if blank line at end of EDL
- totalcutduration Incorrect if EDL Starts with 0.00
- Strange issue with ffmpeg not successfully adding chapters HOT 11
- Desync issues - need to skip first X seconds
- Comcut losing audio on all MKV files recorded with Vorbis audio streams HOT 2
- Using ComCut to find .mpg's in a directory and use the existing EDL to create new file, move to another directory HOT 4
- Comcut outputs files with bad audio when importing .edl files that begin with 0. HOT 1
- SOLVED: comcut occasionally drops video on MKV files HOT 2
- comcut doesn't add the last piece of video from last commercial to end of file HOT 1
- Anyplans to make a windows version? HOT 9
- Powershell Comcut.ps1 version HOT 2
- Why are intermediate files MPEG-TS? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from comchap.