Request for new feature: Autocrop detection
-
- Posts: 13
- Joined: Thu Oct 05, 2006 3:24 pm
Request for new feature: Autocrop detection
I'm working on adding features to a video compression plug-in for SageTV and one of the things I really want to do is autocrop letterboxed 4:3 shows and 4:3 shows crammed into 16:9.
I've been using mplayer which has an autocrop detection feature but i've noticed that it doesn't work very reliably with analog recorded SDTV and gets very confused by logos that are partially/entirely outside of the actual video.
Then, I thought, "hey isn't comskip already awesome at that"? So I fired up the GUI and sure enough it's keeping a nice blue box around the actual video at all times. So I was hoping that it would be possible for you to output some type of crop data?
I've been using mplayer which has an autocrop detection feature but i've noticed that it doesn't work very reliably with analog recorded SDTV and gets very confused by logos that are partially/entirely outside of the actual video.
Then, I thought, "hey isn't comskip already awesome at that"? So I fired up the GUI and sure enough it's keeping a nice blue box around the actual video at all times. So I was hoping that it would be possible for you to output some type of crop data?
There is already a simple solution (at least for me)
Turn on
output_framearray=1
This will make comskip generate a large .csv file containing (the headings minX, maxX are not in the file comskip generates but I inserted them for clarity)
As you can see border is set to 10 so the outmost 10 pixels are discarded
You can change this by changing the border setting in the ini file
The minY, maxY, minX and maxX value can be used to determine the crop window
Turn on
output_framearray=1
This will make comskip generate a large .csv file containing (the headings minX, maxX are not in the file comskip generates but I inserted them for clarity)
Code: Select all
frame brightness scene_change logo uniform sound minY MaxY ar_ratio goodEdge isblack cutscene minX maxX
1 19 0 0 0 276 10 498 141 0 0 0 10 698 0 0
2 30 475 0 11387 272 10 506 141 0 0 100 10 706 85 2112
3 63 265 0 23363 255 10 566 126 0 0 100 10 710 178 2347
4 63 470 0 23281 283 10 566 126 0 0 100 10 710 178 2381
5 63 475 0 23137 263 10 566 126 0 0 100 10 710 179 2346
6 62 475 0 23055 254 10 566 126 0 0 100 10 710 181 2361
7 62 475 0 23048 262 10 566 126 0 0 100 10 710 179 2365
8 62 480 0 23002 257 10 566 126 0 0 100 10 710 178 2379
9 62 475 0 23030 241 10 566 126 0 0 100 10 710 180 2372
10 63 475 0 23074 266 10 566 126 0 0 100 10 710 185 2347
11 63 475 0 23022 264 10 566 126 0 0 100 10 710 177 2434
You can change this by changing the border setting in the ini file
The minY, maxY, minX and maxX value can be used to determine the crop window
-
- Posts: 13
- Joined: Thu Oct 05, 2006 3:24 pm
-
- Posts: 13
- Joined: Thu Oct 05, 2006 3:24 pm
Mostly there
The data in the csv file is perfect, i've got a nice, efficient, function reading in data and outputting the 100% correct crop data everytime.
A few things,
1) I don't think the output folder parameter in the CLI is working properly. Right now, no matter what I put its outputting the csv file next to the original video. That is unless I'm completely missing something... which has been known to happen.
2) Is there anyway to get it to output the .csv file while its running rather than the end. I'm having trouble sending it a clean "ctrl+c" but I can just outright kill the process.
A few things,
1) I don't think the output folder parameter in the CLI is working properly. Right now, no matter what I put its outputting the csv file next to the original video. That is unless I'm completely missing something... which has been known to happen.
Code: Select all
"D:/perl2dvd Dev/Development/perl2dvd/comskip.exe" --ini="D:/perl2dvd Dev/Development/perl2dvd/comskip.ini" "E:/SageRecordings/GoodEats-StuffIt-849894-0.mpg" "D:/perl2dvd Dev/Development/"
The output folder is only used for the generated cutlists.
However your remark does make sense
W.r.t. the crl+C or outputting the .CSV while running.
As audio is often out of sync with video I can not output the .csv while the frames are being processed. Will have too look for the crtl+C thing. How to catch it etc...
Don;t expect quick progress.
However your remark does make sense
W.r.t. the crl+C or outputting the .CSV while running.
As audio is often out of sync with video I can not output the .csv while the frames are being processed. Will have too look for the crtl+C thing. How to catch it etc...
Don;t expect quick progress.
-
- Posts: 13
- Joined: Thu Oct 05, 2006 3:24 pm
I've been doing some brainstorming and I'm fairly certain that I can work around both of those issues pretty easily.
Right now i'm thinking that I can just generate 5 evenly spaced 20 sec clips from the first 30 minutes of the video, put them in my temp folder, run comskip on them, concat the data, and pull out the data like that.
Right now i'm thinking that I can just generate 5 evenly spaced 20 sec clips from the first 30 minutes of the video, put them in my temp folder, run comskip on them, concat the data, and pull out the data like that.
At the end of the log file comskip reports the dominant aspect ratio
Code: Select all
Logo fraction: 0.5659
Maximum volume found: 3030
Average volume: 970
Sound threshold: 500
Silence threshold: 100
Minimum volume found: 0
Average frames with silence: 78
Black threshold: 20
Minimum Black level found: 15
Average brightness: 1064
Uniformity level: 260
Average non uniformity: 446
Maximum gap between logo's: 268
Suggested logo_threshold: 0.7750
Suggested shrink_logo: 5
Max commercial size found: 109
Dominant aspect ratio: 1.2600
Score threshold: 1.0500
Framerate: 25.00
Total commercial length: 0:20:43.00
-
- Posts: 13
- Joined: Thu Oct 05, 2006 3:24 pm
I've got this method coded up and its working amazingly well. Very fast and accurate across a wide range of sources. Also, as an added bonus it works for non-mpegs as it can transcode them if necessary.evilpenguin wrote:I've been doing some brainstorming and I'm fairly certain that I can work around both of those issues pretty easily.
Right now i'm thinking that I can just generate 5 evenly spaced 20 sec clips from the first 30 minutes of the video, put them in my temp folder, run comskip on them, concat the data, and pull out the data like that.
So I guess in addition to being the best commercial detecting software, comskip is the most reliable crop detection software as well. I wonder what else it can do
Generated using Comskip 0.79.113
My Dominant aspect ratio is always zero. Do I need to change a setting to get it to show the correct value. I'm trying to use statik's latest encoding bat file.
cheers
[edit] I just tried it with the UK ini file that was posted in the tuning forum and I now have a DAR value. cool!
My Dominant aspect ratio is always zero. Do I need to change a setting to get it to show the correct value. I'm trying to use statik's latest encoding bat file.
cheers
[edit] I just tried it with the UK ini file that was posted in the tuning forum and I now have a DAR value. cool!
Re: Request for new feature: Autocrop detection
The next build can output a .aspects file with this content
Is this usefull?
Code: Select all
0:00:00.01 1280x 720 1.87 minX= 10, minY= 26, maxX= 910, maxY= 502
0:00:00.05 1280x 720 1.80 minX= 10, minY= 10, maxX=1270, maxY= 710
0:04:28.91 1280x 720 1.30 minX= 186, minY= 10, maxX=1094, maxY= 710
0:05:00.35 1280x 720 2.30 minX= 10, minY= 82, maxX=1270, maxY= 630
0:05:20.37 1280x 720 1.80 minX= 10, minY= 10, maxX=1270, maxY= 710
0:06:13.94 1280x 720 1.38 minX= 162, minY= 10, maxX=1118, maxY= 710
0:06:29.07 1280x 720 1.80 minX= 10, minY= 10, maxX=1270, maxY= 710
0:13:36.41 1280x 720 1.38 minX= 162, minY= 10, maxX=1118, maxY= 710
0:15:00.73 1280x 720 1.80 minX= 162, minY= 82, maxX=1110, maxY= 630
0:15:20.22 1280x 720 1.38 minX= 162, minY= 10, maxX=1118, maxY= 710
0:16:36.73 1280x 720 1.80 minX= 10, minY= 10, maxX=1270, maxY= 710
0:24:04.34 1280x 720 1.38 minX= 162, minY= 10, maxX=1118, maxY= 710
0:25:14.14 1280x 720 2.05 minX= 170, minY= 122, maxX=1118, maxY= 590
0:25:17.75 1280x 720 1.80 minX= 162, minY= 82, maxX=1118, maxY= 630
0:25:19.53 1280x 720 1.38 minX= 162, minY= 10, maxX=1118, maxY= 710
0:25:41.40 1280x 720 1.64 minX= 170, minY= 66, maxX=1118, maxY= 646
0:25:43.51 1280x 720 1.73 minX= 170, minY= 82, maxX=1118, maxY= 630
0:25:47.63 1280x 720 0.00 minX= 154, minY= 10, maxX=1118, maxY= 710
0:25:50.88 1280x 720 1.38 minX= 154, minY= 10, maxX=1118, maxY= 710
0:27:40.71 1280x 720 1.80 minX= 10, minY= 10, maxX=1270, maxY= 710
0:33:44.52 1280x 720 1.38 minX= 162, minY= 10, maxX=1118, maxY= 710
0:37:14.78 1280x 720 1.02 minX= 282, minY= 10, maxX= 990, maxY= 710
0:37:15.81 1280x 720 1.38 minX= 154, minY= 10, maxX=1118, maxY= 710
0:37:34.17 1280x 720 1.80 minX= 10, minY= 10, maxX=1270, maxY= 710
0:45:27.37 1280x 720 1.38 minX= 154, minY= 10, maxX=1118, maxY= 710
0:46:44.80 1280x 720 1.80 minX= 10, minY= 10, maxX=1270, maxY= 710
0:47:45.06 1280x 720 1.38 minX= 162, minY= 10, maxX=1118, maxY= 710
0:49:21.76 1280x 720 1.80 minX= 10, minY= 10, maxX=1270, maxY= 710
0:59:39.52 1280x 720 1.38 minX= 154, minY= 10, maxX=1118, maxY= 710