Code to perform the movie cuts on DM7025

  • I have written a C code hack to actually perform the cuts specified with the cut list editor of DM7025.


    The hack was inspired and guided by the similar package "moviecutter" by Georges. However, you need not wait over the night but it can run in the background as you keep watching on your dreambox, and a typical movie takes about 15 minutes to process.


    What is not yet done is to provide a menu alternative "Apply cuts" next to the "Cutlist editor" alternative in the movie menu. Python is not my language though, so I may need some help with this. Currently you have to log in to the dreambox and run the program from the shell.


    Another drawback is that when a section is removed within a movie the picture freezes and breaks up briefly at the cut (just as it does when you look directly at a movie with cutlist editor cuts). I guess that this means that I fail to hit the GOP-boundaries (which confuses me because I really tried to). Cutting off the start and end of a movie works without such artifacts though.


    There is actually a set of related programs that are provided:


    mcut <filename>
    Copies the sections that are not removed according the the cut list editor marks to a new file with " cut" appended to its name.


    mcutarg <filename> <starttime 1> <endtime 1> [<starttime 2> <endtime 2> ...]
    Copies the sections given as arguments to a new file with " cut" appended to its name. The times are given as <hour:min:sec> as counted from the beginning of the movie, and note that the section between a start time and an end time is *retained* and not removed (i.e. opposite to the cutlist editor semantics where the given sections are removed.)


    lscut <filename>
    Displays the mark times as set by the cutlist editor (if you by some reason don't want to start the cutlist editor to check on screen).


    chcut <filename> <starttime 1> <endtime 1> [<starttime 2> <endtime 2> ...]
    Sets the cut marks for the file without using the cutlist editor according to the specified start and end times. As above, the times are given as <hour:min:sec> as counted from the beginning of the movie, and note that the section between a start time and an end time is *retained* and not removed (i.e. opposite to the cutlist editor semantics where the given sections are removed.)


    mrename <filename> <new filename>
    Renames the movie by renaming all the files involved. Typically, after having cut a movie you may want to delete the original and rename the result to the original name. This can of course be performed as well by a number of "mv" commands at the shell, but the file names are long and there are many files involved for each movie...


    All movie filenames can be given either with or without the ".ts" suffix, and all other suffixes are added by the programs where needed.


    Below are only the binaries for DM7025 included. I guess that some of the programs could be useful even without the cutlist editor (which I understand is only provided on DM7025) although I have no access to other models so I have not been able to verify that it works. If
    someone likes to try to compile them on another dreambox model, please contact me and I'll send you the source code. (Or if you like the source code for any reason at all, since it is under GPL.)


    Best Regards
    Anders Holst

  • tks very much anders !


    i am just giving mcut a try and found a problem that it does not accept the file name. maybe because of spaces or special characters:


    20070712 1529 - DIREKT - Option 1 - Oh, wie schön ist Panama.ts


    tried it without the special characters in schön and renamed that part to schoen, but no go.


    when i edited all the names of the files to Panama mcut worked like a charm.


    PS: found the solution if i put the filename within "" like "whatever fileneam - dd" then it works fine.


    PPS: really very nice speed :smiling_face:

    Einmal editiert, zuletzt von microch ()

  • I have now managed to wrap my C-code in real python plugins with menu interfaces. There are two plugins that work well together (but can be installed and used independently):
    MovieCut-1.0 is to apply Cutlist editor cuts to the movie.
    MovieRetitle-1.0 is to change the filename, title, and description of a movie.
    Both places themselves in the movie list menu, next to the Cutlist editor.


    Thanks for the helpful code examples some of you sent me. Still, it was not an easy task to try to learn python through the enigma code: in the beginning any small modification I tried of the code to make it work the way I wanted either caused enigma to crash, or it didn't compile at all with no way to find out why. However, after endless late nights and exactly 179 enigma crashes, these modules are the results.


    Attached are the two modules plus their readme files.


    Best Regards
    Anders Holst

  • hi sorry 4 my realy late reply but i havent had much time in the last weeks :winking_face:



    so today was the day i have tested your "little" plugin and i have to say GREAT WORK!


    its realy fast very simple - short perfect :smiling_face:


    thx 4 your work

    Dreambox 7000s, 7025ss, 600s, 800s, 8000ss, Hotbird 13°, Astra 19,2°, Astra 23,5°

  • aholst:
    I have looked at your plugin.py of MovieCut-1.0 and it seems that Tabs and Spaces are mixed. And with this i can edit it by myself.


    Can you provide my a Version of the file with better Indentions?


    regards
    3c5x9

  • Hello 3c5x9,


    Yes, I know about the indentations, this was my very first python hack... (It was only half a year ago but if feels like a long time ago.)


    However, within short there will be a new version, and I am hesitant to release a cosmetic fix for an old version in between.


    May I curiously ask if there were some specific feature you planned to add, or what you wanted to change? You are very welcome to do that of course, but I just though I might check so we don't put double work on the same things.


    Best Regards
    Anders Holst

  • Yes, that would be a nice addition.


    I didn't know how to achieve this myself, since I am not too familiar with the concurrent aspects of python, and I always get this strange "modal open are allowed only from a screen which is modal!" error message when I try to open message boxes in unusual but ways but which otherwise ought to be OK.


    So I will happily include it if you succeed. I will send you a recent version of the python code so you can experiment with it.


    Best Regards
    Anders Holst

  • "modal open are allowed only from a screen which is modal!" error message


    This happens when a screen that is not on the Screen (in background of another, closed) opens a new Window (Screen).

    Einmal editiert, zuletzt von 3c5x9 ()

  • (Yes, but then I tend to get the error message also when I would expect my screen to be still active. Of course I must be doing something wrong, but the programming interface is not very intuitive in my opinion.)


    The reason for mentioning it here is that while the cutting is done in the background, the user may enter or leave a number of dialogs and move in or out of the movie player, so from which screen should the message box be opened? Hopefully there is some way to find out the currently active screen.


    Best Regards
    Anders Holst

  • @ alhost: simply perfect ...
    and the same as 3c5x9

    Zitat

    ... add an messagebox at the end of the cut-Process. Thats simply all


    which you good luck in doing v1.01 :smiling_face:


    And one more idea:
    The perfect way for this tool will be an integration into the cutlisteditor himself.


    maybe, it could be possible...


    J.

    There´s no life without dreams...

  • Maybe I'm missing something, but it's not working for me here.


    The MovieCut-1.0-DM7025.ipk would not install from the tmp-Folder of my dreambox, so I manually copied the files fromMovieCut-1.0.tar.bz2 to my 7025 (which has a Boxman image from november).


    When i perform the cuts, I get a message window that the cutting starts in the background. Then nothing happens.


    Anything I can do to check what's wrong? Do I have to set rights after copying?

  • Yes - you have to set the rights of the files within the plugin/moviecut Folder - chmod 755!


    But you do also have to set the cuts with the cutlisteditor first, and afterwards you can execute the cuts with the moviecut-tool - I don't know if you did so in the first place... and there will be no messagebox at the end of the cutting process... The only way to see that cutting is done is by checking the total time of the file being cut in the movie list - as soon as cutting is done the new time will show up...


    btw - it wouldn't install from the tmp folder with Gemini 3.2 as well, but after I copied the manually everything works fine...


    hope this will help ya...

  • Hello almoss, hello all.


    Maybe you have got the help you need, but I may try to clarify things somewhat more.


    1. Failure to install .ipk


    Sorry, this must have slipped through my checking. No-one told me it didn't work until now, and then I notice that it doesn't work for me either... It seems that ipkg is picky about how to pack the control file. (I thought I had followed the recipe for constructing .ipk files exactly. But it doesn't suffice to run "tar" on "control" as I did, it has to be on "./control". Guess if it took me some time to figure out this one, arghh.) There is little point in correcting the old version now when everyone has picked up the tar.bz2 instead, but for the next version I promise to use the correct packaging. And test it myself.


    2. Need to change permission?


    No, it should not be necessary. The .tar.bz2 archive should contain the right permissions for everything in it.


    3. How to find out what goes wrong.


    As discussed above, it would be very nice to get a message when cutting is finished, as well as messages telling when it failed for some reason. With some help I may be able to provide this to the next version, but no promises.


    For now, the best way to see whats wrong is to log in with "telnet" or "ssh" or similar and run the "mcut" program manually:

    Zitat

    cd /hdd/movie
    mcut "FILENAME.ts"


    where FILENAME is the name of the movie file. The double quotes around the name is to protect all spaces in the name. Without further flags to mcut the result will be placed in a new file with " cut" appended to the name, and the original will remain unchanged.


    During operation it will print out the cut intervals in bytes if everything proceeds OK, and print a suitable error message if something goes wrong. Typical things that may go wrong is that the .ap file is missing or empty, or that the destination file already exists.


    Best Regards
    Anders Holst

  • aholst
    True, the archive contains rights, but if you unpack the archive on a regular windows pc they'll be lost. And as the archive wouldn't install by itself, I chose that way - and then you do too have to set the rights... :smiling_face:
    An updated version with some message boxes or progress information would be very nice to have!

  • There is now a new version of MovieCut, version 1.1 of 2008-02-28. The new features are:


    * Cutting is now much more precise: If the cut marks are placed at GOP boundaries, the first frame shown is exactly the one where the IN mark was set, and the last frame shown is about three frames before the frame where the OUT mark is set (unfortunately, making the last shown frame the same as the one with the cut mark has other side effects. But we are talking *frames* in precision here, not GOPS as before).


    (Note however that due to a bug in enigma2 the CutListEditor will set the mark at the right place, but when revisiting the mark you will end up one GOP later. Trust the original mark position, not where it seems to be when jumping to it.)


    * There are no visible flickering or squares at cuts inside the movie any more. There is a small (3 frames long) pause though at each cut. But this is the best I can do without remuxing. And it is not guaranteed to look good when moved from the dreambox.


    * Now a notification will pop up both if cutting is successfully finished, and with a suitable error message if cutting fails. The notification has no timeout, so you won't miss it even if you leave the box for a while. And currently it can't be switched off, so it will disturb you even if you don't want it...


    (I did not use Notifications after all, since they only pop up when an InfoBar is active. In contrast, the cut result popups may hit you at any time in any menu or dialog... But this is a feature: For example you may be standing in the movie list, just waiting for cutting to finish so you can update the list and check the result, or you may not even have left the initial notification that the cut has started.)


    ((But now I REALLY don't understand the "Modal screen" error message - it doesn't seem to do what I thought it was intended for, i.e. to make sure that only the active Screen launches a new Screen. It is actually independent of from which screen you call "Session.open". And it was easy enough to fool...))


    * You can launch several cuts of different movies after each other, and they will be automatically queued up and executed one by one, to avoid exercising the disk unnecessarily.


    * The ipk file is now packaged the right way, so it can be used...


    Best Regards
    Anders Holst