ProjectX

Here you can ask your questions on how to use Comskip for the detection of commercials. Also questions on how to remove commercials are welcome
erik
Site Admin
Posts: 3369
Joined: Sun Aug 21, 2005 3:49 pm

Post by erik »

Comskip uses the PTS as frame count reference.

If project X demuxes first to a ES and it looses the PTS than that would explain the problem.

What you could do is demux the file and then mux again to a mpeg and rerun Comskip

Could help in finding the cause of the problem.
erik
Site Admin
Posts: 3369
Joined: Sun Aug 21, 2005 3:49 pm

Post by erik »

When you set verbose=10, do you see "Video PTS jumped ..." in the log file?
mimwdv
Posts: 44
Joined: Sun May 14, 2006 5:29 am
Location: Sydney, Australia

Post by mimwdv »

Yep, lots of "Vidoe PTS jumped", and "Audio VTS jumped" too.

I tried the demux/remux then comskip, and it didn't solve it. The "PTS jumped" numbers got smaller (especially the really big ones after the logo), but when watching the video the cuts are still out (and by about the same amount for the demux/remux file as for the original file).
erik
Site Admin
Posts: 3369
Joined: Sun Aug 21, 2005 3:49 pm

Post by erik »

Do you see this problem with all recordings or just one?
If it is wtih all, could you upload a part of a file to my ftp server so I can test my demux?
mimwdv
Posts: 44
Joined: Sun May 14, 2006 5:29 am
Location: Sydney, Australia

Post by mimwdv »

Every recording so far. I'll do it when I get home this afternoon. What do you need, and how do I upload it?
mimwdv
Posts: 44
Joined: Sun May 14, 2006 5:29 am
Location: Sydney, Australia

Post by mimwdv »

OK, it's uploaded!
erik
Site Admin
Posts: 3369
Joined: Sun Aug 21, 2005 3:49 pm

Post by erik »

When I test your file I see no problems.
Which comskip build do you use?
The error in build 40 that is causing the problem you described is solved in build 41.
mimwdv
Posts: 44
Joined: Sun May 14, 2006 5:29 am
Location: Sydney, Australia

Post by mimwdv »

I was using build 40, but I've just tried it with 42 (totally replaced my comskip directory but kept my ini file) and am having the same problem! I've only had time to do one file this morning, but the cut version started late and finished 30 frames late. I'll do some more testing to see if I can narrow it down some more.
mimwdv
Posts: 44
Joined: Sun May 14, 2006 5:29 am
Location: Sydney, Australia

Post by mimwdv »

Erik, I've had another look at it, and part of my problem was created by some files which were corrupted due to bad reception - obviously not something you can do anything about.

But there also seems to be something a bit odd with the way Comskip's creating the XCL file. When I first run Comskip, it creates these TXT and XCL files:
FILE PROCESSING COMPLETE 112137 FRAMES AT 2500
-------------------
1 1653
9159 13303
95290 112137

and
CollectionPanel.CutMode=4
0:0:0.00
0:0:0.04
0:1:6.20
0:6:6.36
0:8:52.20
1:3:31.60
which makes ProjectX cut in at the beginning, cut out after the first frame, and add a cutpoint at the end of the file (which ProjectX interprets as a cut-in, but does nothing with since there's no frames after it). After I re-load the TXT file into Comskip, change 1 frame in the debug window and write the files again I get:
FILE PROCESSING COMPLETE 112136 FRAMES AT 2500
-------------------
1 1652
9159 13303
95290 112137

and
CollectionPanel.CutMode=4
0:1:6.16
0:6:6.36
0:8:52.20
1:3:31.60
which cleans up the extra frame at the beginning (don't know why that's different to what Comskip does initially). But those cut points are wrong by several frames each time - its calculations from frames to time seems be out.

A solution might be that since ProjectX accepts cutting by frame numbers it doesn't need to be converted to time. When I write something like this:
CollectionPanel.CutMode=2
1652
9159
13303
95290
ProjectX cuts exactly on the frames each time. Is it possible to add that in as an output option to a future version of Comskip? Or change the existing ProjectX output to use frame numbers?

The only issue might be that ProjectX expects the first number given to be a "cut in" point, so if you don't want your first commercial to start at frame 1, you need to add a 0 to the front of the file. Does that make any sense at all :?
a_a
Posts: 7
Joined: Tue Nov 08, 2005 12:15 pm
Location: Sydney, Australia

Post by a_a »

@mimwdv

I'm sure Erik will look into incorporating your request when he gets a chance... :)

In the meantime you might like to test this batch file for me. It'll read a comskip.txt file and output the ProjectX cutfile in the format that you've suggested. Please let me know if it works... ;)

HTH.

Adrian.

Code: Select all

@echo off
SETLOCAL
rem Batch file to take a comskip.txt file and produce a ProjectX frame-based cutfile.

if /%1/==// goto usage
if /%1/==/-h/ goto usage
if /%1/==/--help/ goto usage
if /%1/==/-?/ goto usage
if /%1/==//?/ goto usage


set infile=%~f1
if "%infile%"=="" (
  echo.
  echo I need an input file.
  goto :usage
)
if not exist "%infile%" (
  echo.
  echo Input file not found: "%infile%"
  goto :usage
)
set infile_noext=%~n1
set infile_ext=%~x1

if not %infile_ext%==.txt (
  echo.
  echo Invalid input file type: "%infile_ext%"
  echo Expecting a .txt file.
  goto :usage
)

:infile_ok
call :fixdir "%~1"
set indir=%fixdir%


set outfile=%~f2
if "%outfile%"=="" set outfile=%infile_noext%.mpg.xcl
if exist "%outfile%" move /Y "%outfile%" "%outfile%.bak"


echo.
echo Converting Comskip .txt file to ProjectX frame-based cutfile
echo  Input file  : "%infile%"
echo  Output file : "%outfile%"
echo.

set frames=0
set startpos=1
set endpos=0
set showsegs=0

echo CollectionPanel.CutMode=2 > "%outfile%"
rem Process all the lines from the Comskip output file
for /F "usebackq tokens=1,2,3,4,5,6,7,8*" %%i in ("%infile%") do call :process_comskip_txt %%i %%j %%k %%l %%m %%n %%o 

if %frames%==0 (
  echo Failed to find number of frames in the Comskip .txt file
  goto :usage
)
echo Frames: %frames%

rem Add final chapter if necessary
if %startpos% geq %frames% goto :no_last_segment
set /a showsegs = %showsegs% + 1
set endpos=%frames%
echo.%startpos% >> "%outfile%"
echo.%endpos% >> "%outfile%"

:no_last_segment
echo Found %showsegs% show segments
echo.
echo ProjectX cutfile written to "%outfile%"
echo.

goto :end


:usage

echo.
echo Usage:
echo %~nx0 comskip.txt [projectx.xcl]
echo.
echo. Convert the comskip.txt file into a frame-based cutfile for ProjectX.
echo.
goto :end


:fixdir

rem Remove final slash from directory name
rem Note: Ensure input parm has *at least* one trailing back-slash
rem       or it will return the parent directory.
rem       If passed a filename, will return it's directory
set fixdir=%~dp1
if "%fixdir:~-1,1%"=="\" set fixdir=%fixdir:~0,-1%
goto :eof


:process_comskip_txt

if "%2"=="" goto :eof
rem Find number of frames from FILE line
if not "%1"=="FILE" goto :normal_line
set frames=%4
goto :eof
:normal_line
set /a endpos = %1 - 1
if %endpos% leq 0 goto :firstline
set /a showsegs = %showsegs% + 1
echo.%startpos% >> "%outfile%"
echo.%endpos% >> "%outfile%"
:firstline
set /a startpos = %2 + 1
goto :eof


:end
ENDLOCAL
:eof
P.S. Some of this code was ripped from Erik's Comclean.bat. Hope you don't mind... :?
erik
Site Admin
Posts: 3369
Joined: Sun Aug 21, 2005 3:49 pm

Post by erik »

The solution will depend of the player you use.
Which one do you use?
mimwdv
Posts: 44
Joined: Sun May 14, 2006 5:29 am
Location: Sydney, Australia

Post by mimwdv »

Erik, I use projectX to cut the file (and its subtitles), then either author and burn a DVD using ifoedit and nero, or convert to Xvid with mencoder. The final result gets played either in one of our standalone DVD players, or else using zoomplayer, mplayer, or mplayer classic. Out of curiousity, why does this matter in ProjectX's cutfile?

Adrian, thank you! I'll give your script a go and let you know - it looks good!
erik
Site Admin
Posts: 3369
Joined: Sun Aug 21, 2005 3:49 pm

Post by erik »

So you inspect the file using projectX and with project X you see that the cutpoints are progressively wrong towards the end of the file.
And when you use comskip to inspect the cutpoints they are at the right position.

What is the size of jumps you see?
If they are above 40 but below say 200 you could try to set the max repair size to 200.
mimwdv
Posts: 44
Joined: Sun May 14, 2006 5:29 am
Location: Sydney, Australia

Post by mimwdv »

Thanks, Erik, I'll have a play around with the max repair size settings. And Adrian - thanks for your script - it works really well!
mimwdv
Posts: 44
Joined: Sun May 14, 2006 5:29 am
Location: Sydney, Australia

Post by mimwdv »

After much trial and error, I think there's something funny with how ProjectX interprets its time codes using cutmode=4. Comskip's mpeg repair settings don't seem to make a difference.

I don't know whether it's just my compiled version of ProjectX (which I got from Doom9), or some other setting somewhere, but if I use the Xcl file Comskip exports, I get a delay of a couple of seconds on every ad break (ie it cuts in and out late, but it doesn't seem to get any worse towards the end of the file).

But if I convert Comskip's txt file to an Xcl with frame numbers only (ie ProjectX cutmode=2) it works perfectly. And thanks to Adrian's script above, I can do it automatically!

Thank you both for your help!

And Erik, thanks very much for creating Comskip. It's making my TV recording much easier!
Post Reply