Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
|
|
Thread Tools | Search this Thread | Display Modes |
21st October 2011, 03:08 | #1 | Link |
Registered User
Join Date: Jul 2011
Posts: 224
|
New Application trimsrt trims and shifts srt subtitle file based on range of frames
I made a couple of posts and searched everywhere I could think of for an application that would take an srt subtitle file and trim/shift it based on a range of frames for situations where you do something like this in Avisynth:
Code:
A = NicAC3Source("E:\AviSynth\job.ac3") V = FFVideoSource("E:\AviSynth\job.mkv") AudioDub(V, A) AlignedSplice(Trim(2832, 16727), Trim(16896, 31295)) The Source code is included, I release it under the GPL. If you find any problems please report them. If you know c++ and fix a problem or extend the application, please share. I just started using Avisynth a couple of weeks ago, and I just wrote this application over the last couple days. So far it has worked perfectly for me, but consider it to be in Beta testing stage. most of my testing has been using 2 frame ranges (2832,16727,16896,31295), but it should accept as many frame ranges as you need. Code:
Usage is -i <file> -f <fps> -t <frames> omitting -f <fps> assumes an fps of 23.976024 trimsrt -i 004.srt -t 2832,16727,16896,31295 trimsrt -i 004.srt -f 29.97 -t 2832,16727,16896,31295 other format conversion to srt tip: To convert SUB/IDX or .SUP to .SRT. I recommend using Subtitle Edit: http://forum.doom9.org/showthread.php?t=162721 Last edited by xekon; 25th October 2011 at 21:42. |
21st October 2011, 18:55 | #4 | Link |
Registered User
Join Date: Aug 2008
Location: The Land Of Dracula (Romania - EU)
Posts: 934
|
thanks a lot...
_
__________________
if you ask a question and somebody give you the correct answer don't forget to leave a "thank you" note... Visit The Land Of Dracula (Romania - EU)! |
21st October 2011, 22:11 | #6 | Link |
Registered User
Join Date: Sep 2008
Posts: 365
|
Thanks.. You can easily convert a .srt subtitle to .ass subtitle format with Aegisub if you don't have any .ass files lying around...
Have to say I'm quite surprised you haven't touch .ass subtitles before, it's a superior subtitle format compared to srt. |
18th March 2015, 22:44 | #7 | Link |
Registered User
Join Date: Nov 2014
Posts: 36
|
Does anyone still use this tool? It sounds exactly like something I'd love to use, unfortunately, the cuts are never correct, and I don't know why.
I noticed that no matter what fps value I entered (-f 25 or -f 50, PAL region), the resulting srt file were exactly the same. What am I missing here? |
18th March 2015, 22:49 | #8 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Dont know but just a daft suggestion, try eg -f 25.0 or -f 50.0 ie with .0
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? |
18th March 2015, 22:58 | #10 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Give the exact command that fails please.
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? |
18th March 2015, 23:00 | #11 | Link |
Registered User
Join Date: Jul 2011
Posts: 224
|
Everything I have used it with so far is 23.976 fps.
This was the initial release and I may possibly still have the fps value hard coded in the code. Unfortunately I am too busy to look at it now, but the source code trimsrt.cpp file was included in the zip, if anyone wants to make updates before I get the time to, feel free. |
18th March 2015, 23:06 | #12 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
xekon, fps is defaulted to 23.976 FPS and then updated if -f flag used, but not used at all after that, ,seems to use 23.976 for everything.
I'll try to fix it but really dislike the CPP style lib funcs.
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? |
18th March 2015, 23:28 | #14 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Ok, made changes but getting error
Code:
char* myFile; string myFileb; char* myFrames; vector<string> v; double fps=23.976024; for (int i = 1; i < argc; i++) { //We will iterate over argv[] to get the parameters stored inside. string param = argv[i]; if (param == "-i") { myFile = argv[i + 1]; myFileb = string(myFile).substr(0,(string(myFile).length())-4); myFileb.append("new.srt"); i=i++;//skip next param, its a value } else if (param == "-f") { fps = godouble(argv[i + 1]); i=i++;//skip next param, its a value } else if (param == "-t") { myFrames = argv[i + 1]; i=i++;//skip next param, its a value string s = myFrames; split(s, ',', v); if ((v.size( ) % 2) != 0) { std::cout << "Not an even number of frames, please try again.\n"; system("Pause"); exit(0); } } else { std::cout << "Not enough or invalid arguments, please try again.\n"; system("Pause"); exit(0); } } ifstream a_file (myFile); ofstream a_file_out (myFileb); Code:
Compiling... trimsrt.cpp N:\SJ\SOURCE ARCHIVE\VC\AVISYNTH FILTERS\25\_NOTMINE\trimsrt\trimsrt.cpp(123) : error C2664: '__thiscall std::basic_ofstream<char,struct std::char_traits<char> >::std::basic_ofstream<char,struct std::char_traits<char> >(const char *,int)' : cannot convert parameter 1 from 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' to 'const char *' No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called Error executing cl.exe. trimsrt.exe - 1 error(s), 0 warning(s) EDIT: xekon, what was it originally compiled with ?
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 18th March 2015 at 23:41. |
18th March 2015, 23:39 | #15 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Tried with VS6 originally, re-tried with VS2008 and still same error.
What was it originally compiled with ? (non modded source produces error too).
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 18th March 2015 at 23:42. |
19th March 2015, 00:06 | #17 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
OK, managed to get it to compile by adding myFileb.c_str() stuff in blue.
VS2008 compiles OK, but VS6 produces Linker errors about "__security_check_cookie", no idea what that is. Anyways, heres the fixed (I hope) version together with original source. http://www.mediafire.com/download/8o...yv/trimsrt.zip EDIT: Code:
libcp.lib(xlocale.obj) : error LNK2001: unresolved external symbol @__security_check_cookie@4
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 19th March 2015 at 00:08. |
19th March 2015, 00:41 | #19 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
OK, I'll attach the zip here.
EDIT: No runtimes required.
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 19th March 2015 at 00:51. |
22nd January 2016, 10:32 | #20 | Link |
Registered User
Join Date: Jul 2011
Posts: 224
|
Thanks for the update StainlessS! I figured i must forgot to swap out the hard coded values for the variable, strange about those compiler problems, I believe i originally used VS2008, but it could have been VS2010 i really cant remember. Need to remember to put stuff like that in the comments
|
Thread Tools | Search this Thread |
Display Modes | |
|
|