Mencoder - how do I make a script that replace the implements filenames automatically
So I've been doing some studying on Mencoder, it is actually a really good useful program.
So I made a command for hardcoding subs, but the only issue is I want to make this a script that can be used in Nautilus and will automatically fill in the input file names and create an output file name based on the input file name.
Here's what I have so far:
Code:
mencoder movie.avi -sub moviesubs.srt -subfont-text-scale 3.3 -subpos 96 -o /dev/null -oac copy -ovc lavc -lavcopts vcodec=mpeg4:vpass=1 -o movieWithSubs.avi
Can someone add some tweaks to it for me? thanks in return and its much appreciated.
Re: Mencoder - how do I make a script that replace the implements filenames automatic
Are you saying that you want to be able to right-click a file in Nautilus and call the script?
If so, open Nautilus. Go to File > Scripts > Open Scripts Folder > Show more details. (If you don't see that menu item, you need to place a script (any script) in ~/.gnome2/nautilus-scripts first).
Re: Mencoder - how do I make a script that replace the implements filenames automatic
install nautilus-actions that allows you to create custom entries and fine tune their properties (files or dirs, filetypes, single or multiple selection)
as for script part
assuming that your script gets movie file as a parameter - name will be stored in $1
Code:
#!/bin/bash
mencoder "$1" -sub moviesubs.srt -subfont-text-scale 3.3 -subpos 96 -o /dev/null -oac copy -ovc lavc -lavcopts vcodec=mpeg4:vpass=1 -o "${1%.*}WithSubs.${1##*.}"
there is some voodoo just in case you want to preserve file extension, but not necessarily hardcoded avi
${1%.*} = everything from $1 except shortest possible '.<anything>' on the right -> extension is out, name stays
${1##*.} = everything from $1 except longest possible '<anything>.' on the left -> whole name is out, extension stays
i don't know if the subs file should be dependent on movie name so i left it untouched
Re: Mencoder - how do I make a script that replace the implements filenames automatic
Quote:
Originally Posted by
Paddy Landau
Are you saying that you want to be able to right-click a file in Nautilus and call the script?
If so, open Nautilus. Go to File > Scripts > Open Scripts Folder > Show more details. (If you don't see that menu item, you need to place a script (any script) in ~/.gnome2/nautilus-scripts first).
Yes, I've already completed that, I understand how to install scripts to work with Nautilus. but thank you for the information :)
Quote:
Originally Posted by
Vaphell
install nautilus-actions that allows you to create custom entries and fine tune their properties (files or dirs, filetypes, single or multiple selection)
as for script part
assuming that your script gets movie file as a parameter - name will be stored in $1
Code:
#!/bin/bash
mencoder "$1" -sub moviesubs.srt -subfont-text-scale 3.3 -subpos 96 -o /dev/null -oac copy -ovc lavc -lavcopts vcodec=mpeg4:vpass=1 -o "${1%.*}WithSubs.${1##*.}"
there is some voodoo just in case you want to preserve file extension, but not necessarily hardcoded avi
${1%.*} = everything from $1 except shortest possible '.<anything>' on the right -> extension is out, name stays
${1##*.} = everything from $1 except longest possible '<anything>.' on the left -> whole name is out, extension stays
i don't know if the subs file should be dependent on movie name so i left it untouched
Thank you for explaining how the '$1' parameter works, that's what's been puzzling me. I've been trying to figure out how I can create a script that will work universally for any movie file I want to add subs to without having to go in and edit the code each time.
Now as far as the rest of the code, was I on the right track or no? because this is the first time I've really went and used the CLI for Mencoder.
----UPDATE-----
Also, is there a way I could possibly edit the bash script to include a sort of progress bar, if you will? like say a GUI progress bar to show how much/close it is to being done?
Re: Mencoder - how do I make a script that replace the implements filenames automatic
Re: Mencoder - how do I make a script that replace the implements filenames automatic
if you need gui for your script, look at zenity with --progress parameter. Unfortunately i have no experience with it. I'd just run the script from terminal without bothering with useless bling ;-)
Re: Mencoder - how do I make a script that replace the implements filenames automatic
Quote:
Originally Posted by
Vaphell
if you need gui for your script, look at zenity with --progress parameter. Unfortunately i have no experience with it. I'd just run the script from terminal without bothering with useless bling ;-)
for some reason I'm running into the issue where the subbed video has lower quality than the original video.
I'll show you:
Original: http://i.imgur.com/zmVcP.png
Sub encoded: http://i.imgur.com/xfRIB.png
is there something wrong with the code?
Re: Mencoder - how do I make a script that replace the implements filenames automatic
no idea, i think you should ask in the Multimedia & Video subforum
Re: Mencoder - how do I make a script that replace the implements filenames automatic
It's probably smaller because you're using a more efficient codec to store the re-encoded file. That would be true if, for instance, the original is in MPEG2, and you're encoding to MPEG4. If you want an exact copy, use "-ovc copy".
Re: Mencoder - how do I make a script that replace the implements filenames automatic
Quote:
Originally Posted by
SeijiSensei
It's probably smaller because you're using a more efficient codec to store the re-encoded file. That would be true if, for instance, the original is in MPEG2, and you're encoding to MPEG4. If you want an exact copy, use "-ovc copy".
I'm going to give that a shot right now - thanks, I'll let you know what I get.
Do I replace the
Code:
-lavcopts vcodec=mpeg4
line as well? with a simple ?