LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-25-2013, 07:44 AM   #1
bbb13
Member
 
Registered: Mar 2012
Distribution: Manjaro XFCE 0.8.10, Fedora 19 XFCE, Fedora 20 Cinnamon
Posts: 41

Rep: Reputation: Disabled
mencoder script problem


Code:
#!/bin/bash
for file
do
base=${file%.*}
ext=${file##*.}
newname=${base}"_subt".mpg
mencoder "$file" -sub ${base}.srt -subcp utf-8 -font /usr/share/fonts/msttcorefonts/arial.ttf -subfont-text-scale 2.5 -oac lavc -ovc lavc -of mpeg -mpegopts format=dvd:tsaf -vf harddup -srate 44100 -af lavcresample=44100 -lavcopts vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=5000:keyint=15:vstrict=0:acodec=mp2:abitrate=128:aspect=16/9 -ofps 25 -o "$newname"  | zenity --progress --text="Working: $file" --pulsate --auto-close
done
zenity --info \
--text="Finished"
whats wrong with this script?it's supposed to convert a video file to mpeg2 and embed the subtitles.i tried it in an mp4 file and it worked.i tried in mkv and it does convert the video but doesn't embed the subs. so any ideas how should i make the script to work.with all filetypes?
 
Old 03-25-2013, 04:10 PM   #2
Pearlseattle
Member
 
Registered: Aug 2007
Location: Zurich, Switzerland
Distribution: Gentoo
Posts: 999

Rep: Reputation: 142Reputation: 142
Not a direct response to your question, anyway:
- as stated by the persons that did the fork of "mplayer2", "The MEncoder codebase was in very bad shape.", so it might be that you just hit a bug if it works with the target mp4 container but not with mkv.
- if you feel desperate have a look at "mkvmerge" (part of the "mkvtoolnix"-package). I usually use "mmg" (part of the same package) for target mkv-containers, which uses the same codebase as mkvmerge, and it always worked great for all kind of source formats being audio, video or subtitles.

Cheers
 
Old 03-25-2013, 06:28 PM   #3
w1k0
Senior Member
 
Registered: May 2008
Location: Poland
Distribution: Slackware (personalized Window Maker), Mint (customized MATE)
Posts: 1,309

Rep: Reputation: 234Reputation: 234Reputation: 234
That works for me:

embsub
Code:
#!/bin/bash

if [ "$1" == "" ]; then echo "embsub file.avi" ; exit; fi

infile="$1"
subfile="${infile%.*}.srt"
outfile="${infile%.*}.sub.avi"

string=`mplayer "$infile" -endpos 1 2> /dev/null | grep fps`

scale=`echo $string | awk '{print $3}'`
fps=`echo $string | awk '{print $5}'`

width=$scale
width=${width/x*/}
height=$scale
height=${height/*x/}

bitrate=`expr $width \* $height \* 50 \* 25 / 256`

mencoder "$infile" -sub "$subfile" -subcp utf8 -oac copy -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=$bitrate -o "$outfile"
Feel free to customize it to your needs.
 
Old 03-26-2013, 12:23 PM   #4
bbb13
Member
 
Registered: Mar 2012
Distribution: Manjaro XFCE 0.8.10, Fedora 19 XFCE, Fedora 20 Cinnamon
Posts: 41

Original Poster
Rep: Reputation: Disabled
ok i'll test it and let you know
 
Old 03-26-2013, 03:18 PM   #5
w1k0
Senior Member
 
Registered: May 2008
Location: Poland
Distribution: Slackware (personalized Window Maker), Mint (customized MATE)
Posts: 1,309

Rep: Reputation: 234Reputation: 234Reputation: 234
When you’ll customize the script to your needs publish here the working version as well.
 
Old 03-26-2013, 03:28 PM   #6
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
i would look into xvidenc and h264enc.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Batch script for Mencoder??? JungMin Linux - Software 11 11-21-2011 03:34 AM
basic shell script + mencoder darvil Linux - Server 2 01-25-2010 12:05 AM
mencoder script help needed mrgreaper Linux - Newbie 14 09-14-2009 12:13 PM
Help making a simple script for mencoder. joney_bravo Programming 3 01-01-2007 06:28 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:04 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration