VideoHelp Forum
+ Reply to Thread
Results 1 to 18 of 18
Thread
  1. Hi,
    Does anyone know how I can add an empty line underneath every line of my files? The idea is to have the subtitles appear slightly higher on the screen when I play my files on my blu-ray player, and this is the only way I found to do it (outside of remuxing the video files).

    I looked for a way to do that with subtitle edit, and batch convert the files, but I can't find a way.
    Quote Quote  
  2. Member
    Join Date
    Apr 2007
    Location
    Australia
    Search Comp PM
    This seems to work. The space between the control characters (\n) is a hard space.
    You get it by typing Alt+032 on your keyboard.
    I did the following with a text editor. No idea how using Subtitle Edit.


    video.srt
    Code:
    1
    00:00:02,440 --> 00:00:8,640
    This is a single line of text.
    \n \n
    
    2
    00:00:10,640 --> 00:00:16,760
    This is a wrapped line of text. Well, it will be when I've typed in enough words. Are we there yet?
    \n \n
    
    3
    00:00:18,760 --> 00:00:21,240
    I've started yet another line. Who's an eccentric?
    \n \n
    
    4
    00:00:23,400 --> 00:00:27,640
    Now the text should have dropped back to the original position..
    
     5
    00:00:31,400 --> 00:00:33,640
    I hope this helps you.
    Try my subs with a video you have.
    Cheers.
    Quote Quote  
  3. Member
    Join Date
    Apr 2007
    Location
    Australia
    Search Comp PM
    I found you can also do it like this.
    Code:
    1
    00:00:02,440 --> 00:00:8,640
    This is a single line of text.\n \n
    
    2
    00:00:10,640 --> 00:00:16,760
    This is a wrapped line of text. Well, it will be when I've typed in enough words. Are we there yet?\n \n
    
    3
    00:00:18,760 --> 00:00:21,240
    I've started yet another line. Who's an eccentric?\n \n
    
    4
    00:00:23,400 --> 00:00:27,640
    Now the text should have dropped back to the original position..
    
    5
    00:00:31,400 --> 00:00:33,640
    I hope this helps you.
    This might be a simple thing with Subtitle Edit.
    Quote Quote  
  4. Yes, it seems to be working, thank you!
    Now if anyone knows how to add that underneath every single line, using Subtitle Edit or another program, that'd be great

    Edit: The first way works, the second one doesn't seem to.
    Last edited by Nico Darko; 14th Jan 2023 at 21:01.
    Quote Quote  
  5. Now if anyone knows how to add that underneath every single line, using Subtitle Edit or another program, that'd be great

    Code:
    awk "!/^[A-Z]/{print } /^[A-Z]/{ print $0\"\n\134n\134n\" }" video.srt



    where video.srt is the subtitle file
    Quote Quote  
  6. Another way

    Code:
    awk "/^[A-Z]/{print;print \"\134n\134n\";next}1" video.srt
    Quote Quote  
  7. Thanks, but it's not working properly. A lot of the lines turn like this:

    It'll give me focus, help
    \n \n
    increase my resources.
    instead of the \n \n being underneath the second line only.

    Some lines are like this:

    How's my favourite chess partner?
    \n \n
    Still leading with your knight?
    \n \n
    Some don't have \n \n at all. The few ones where it works only have one line:

    Plans? We planned plans?
    \n \n
    Quote Quote  
  8. Most srt renders will "display" this as a blank line (html itallics tags with a space between them):

    <i> </i>
    Quote Quote  
  9. this will work provided the sub title text starts with the letters A to Z or a to z.

    Code:
    awk "/^[A-Z,a-z]/ { c = 2 } --c == 0 { print \"\134n\134n\" } {print $0}"  video.srt
    If you wish to use <i> </i> , as recommended by jagabo, then use


    Code:
    awk "/^[A-Z,a-z]/ { c = 2 } --c == 0 { print \"\074i\076 \074/i\076\" } {print $0}"  video.srt
    Quote Quote  
  10. Great, thank you, it's working. But is there a way to change the code for when the line starts with the symbol " and - ?

    Also I've been able to see the result by adding "pause" at the end, but I don't see how to save the new srt file?
    Quote Quote  
  11. This should do the trick.

    Code modifies text that start with uppercase, lowercase, comma, quotation and minus. Modified file is saved to video_modified.srt


    Code:
    awk "/^[\042A-Z,a-z-]/ { c = 2 } --c == 0 { print \"\074i\076 \074/i\076\" } {print $0}"  video.srt  > video_modified.srt
    Quote Quote  
  12. Some players allow you to adjust the position of subtitles on the screen...
    Quote Quote  
  13. Originally Posted by jack_666 View Post
    This should do the trick.

    Code modifies text that start with uppercase, lowercase, comma, quotation and minus. Modified file is saved to video_modified.srt


    Code:
    awk "/^[\042A-Z,a-z-]/ { c = 2 } --c == 0 { print \"\074i\076 \074/i\076\" } {print $0}"  video.srt  > video_modified.srt
    Works perfectly, thanks so much!
    Final question, how can I turn the code to batch mode? because I need to apply this to at least 30 srt files.

    Originally Posted by blud7 View Post
    Some players allow you to adjust the position of subtitles on the screen...
    Yeah, no such option on my Samsung player unfortunately.
    Quote Quote  
  14. using a loop ... need to copy this code and save as whatever.cmd and place in appropriate folder (where all your .srt files are stored).


    Run the script from the same folder (very important). The resultant modified file will have the same name as original but with the word 'new' added


    Code:
    for %%f in (*.srt) do ( awk "/^[\042A-Z,a-z-]/ { x++; c = 2 } --c == 0 { print \"\074i\076 \074/i\076\" } {print $0}" %%f  > %%~nf_new.srt )
    Quote Quote  
  15. Perfect, thanks again!
    Quote Quote  
  16. I've just realized that awk doesn't work if the name of the subtitle file has any space in it. Is there a way around that? because I have a bunch of files that have spaces in their name.
    Quote Quote  
  17. Nothing to do with awk. It's a standard command line issue -- space is a demarker between arguments. Put double quotes around the filenames.

    Code:
    ... "%%f"  > "%%~nf_new.srt"
    Quote Quote  
  18. Great thank you, that'll save me a lot of time!
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!