Page 2 of 2 FirstFirst 12
Results 11 to 18 of 18

Thread: Mencoder - how do I make a script that replace the implements filenames automatically

  1. #11
    Join Date
    Nov 2008
    Location
    Boston MetroWest
    Beans
    16,326

    Re: Mencoder - how do I make a script that replace the implements filenames automatic

    Yes, if you're not using lavc then there are no lavcopts.

    That said, I'm not advocating preserving ancient MPEG2 encodings. MPEG2 dates back to the late 1990's and is pretty much only used on traditional DVDs and by some terrestrial HD broadcasters. MPEG4 is considerably more efficient, as your size comparison indicates, and I doubt you could see the difference in video quality on-screen.

    These days the codec of choice is H.264, a variant of MPEG4, which achieves even better compression at equivalent quality. Most streaming sites like YouTube are encoded with H.264 as are most unauthorized video rips out there on the Internet. The drawback of using H.264 is its higher computational demands for decoding. Older hardware with slower CPUs generally can't decode HD H.264 encodes in real time. Modern video cards often include hardware H.264 decoders these days, in particular NVIDIA cards which offer the VDPAU interface. You'll see postings here from time to time complaining that they can't play modern video files on their computers. Usually they're trying to play a 720p or 1080p H.264 encode on computers whose CPUs aren't up to the task.

    I suggest you watch a few minutes of the two files you mentioned above and see if you can detect any obvious quality differences. If not, then I'd stick to MPEG4 or use H.264. Handbrake is a GUI-based DVD ripper and video converter that makes creating H.264 encodes pretty painless. It also handles things like multiple audio and subtitle tracks with ease.

  2. #12
    Join Date
    Sep 2011
    Beans
    457

    Re: Mencoder - how do I make a script that replace the implements filenames automatic

    when I open nautilus and go to file I don't see scripts, would gksu nautilus show me this menu? But all that would change is permissions, unless that changes what you are allowed to see with the interface. I'm not sure.. gksu nautilus seems it would get you deeper in there, wondering why scripts isn't in file. Let me re read this to see if OP got what he needed solved. I'm not great at writing scripts though, just using higher level code that utilizes already written scripts, I don't know much about writing them but want to get into that

  3. #13
    Join Date
    Sep 2011
    Beans
    457

    Re: Mencoder - how do I make a script that replace the implements filenames automatic

    Quote Originally Posted by SeijiSensei View Post
    Yes, if you're not using lavc then there are no lavcopts.

    That said, I'm not advocating preserving ancient MPEG2 encodings. MPEG2 dates back to the late 1990's and is pretty much only used on traditional DVDs and by some terrestrial HD broadcasters. MPEG4 is considerably more efficient, as your size comparison indicates, and I doubt you could see the difference in video quality on-screen.

    These days the codec of choice is H.264, a variant of MPEG4, which achieves even better compression at equivalent quality. Most streaming sites like YouTube are encoded with H.264 as are most unauthorized video rips out there on the Internet. The drawback of using H.264 is its higher computational demands for decoding. Older hardware with slower CPUs generally can't decode HD H.264 encodes in real time. Modern video cards often include hardware H.264 decoders these days, in particular NVIDIA cards which offer the VDPAU interface. You'll see postings here from time to time complaining that they can't play modern video files on their computers. Usually they're trying to play a 720p or 1080p H.264 encode on computers whose CPUs aren't up to the task.

    I suggest you watch a few minutes of the two files you mentioned above and see if you can detect any obvious quality differences. If not, then I'd stick to MPEG4 or use H.264. Handbrake is a GUI-based DVD ripper and video converter that makes creating H.264 encodes pretty painless. It also handles things like multiple audio and subtitle tracks with ease.
    I was looking into this a bit:

    https://help.ubuntu.com/community/MEncoder

    adequately do the same task to convert and export a file into this format?(as you said):

    http://en.wikipedia.org/wiki/H.264/MPEG-4_AVC
    Attached Images Attached Images

  4. #14
    Join Date
    Nov 2008
    Location
    Boston MetroWest
    Beans
    16,326

    Smile Re: Mencoder - how do I make a script that replace the implements filenames automatic

    I don't often recommend GUI-based programs for tasks that I can accomplish easily from the command prompt or with a bash script. That said, I think Handbrake is still the better option. You can queue up multiple conversions, then have them execute sequentially.

    That said, a simple script to iterate over all the .AVI files in a directory and add the subs would look something like this:

    Code:
    #!/bin/bash
    
    mkdir -p subs
    
    for f in *.avi
    do
       MOVIE=$(basename $f)
       mencoder $MOVIE.avi -sub $MOVIE.srt -subfont-text-scale 3.3 -subpos 96  -oac copy -ovc lavc -lavcopts vcodec=mpeg4:vpass=1 -o subs/$MOVIE.avi
    done
    This script iterates overall all .avi files in the current directory, creates a "subs" directory below that, and puts the re-encoded files there. It also assumes that the SRT file for "movie.avi" is called "movie.srt". Massage as needed.

    OP, I lost track of the original intent here. You cannot use "-ovc copy" if you want to add hard subtitles. You do need to re-encode the video so the subtitles can be "burned in." If you want to add soft subtitles like .ssa or .()ss (damn content filter), you'd need to put the output into a different container that supports subtitle streams like MP4 or, better, Matroska (.MKV). This would be easier to accomplish with Handbrake.

    For a quick overview of encoding strategies with mencoder, I recommend this howto from Gentoo, and the complete manual from the mplayer folks here.
    Last edited by SeijiSensei; April 12th, 2012 at 03:53 PM.

  5. #15
    Join Date
    Sep 2011
    Beans
    457

    Re: Mencoder - how do I make a script that replace the implements filenames automatic

    right...

    !/bin/bash
    /bin/bashlis
    bash: /bin/bashlis: No such file or directory
    danel@danel-Dimension-4700:~$
    danel@danel-Dimension-4700:~$ mkdir -p subs
    danel@danel-Dimension-4700:~$
    danel@danel-Dimension-4700:~$ for f in *.avi
    > do
    > MOVIE=$(basename $f)
    > mencoder $MOVIE.avi -sub $MOVIE.srt -subfont-text-scale 3.3 -subpos 96 -oac copy -ovc lavc -lavcopts vcodec=mpeg4:vpass=1 -o subs/$MOVIE.avi
    > done

    now OP will have to be familiar with this prompt? Interesting I wonder what that converted if it didn't cd into bin then bash correctly. Good advice though lot's to learn


    well never mind that last part, I got my answer:

    mencoder: Symbol `ff_codec_bmp_tags' has different size in shared object, consider re-linking
    MEncoder SVN-r33713-4.6.1 (C) 2000-2011 MPlayer Team
    File not found: '*.avi.avi'
    Failed to open *.avi.avi.
    Cannot open file/device.

    Exiting...

  6. #16
    Join Date
    Jul 2007
    Location
    Poland
    Beans
    4,499
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: Mencoder - how do I make a script that replace the implements filenames automatic

    basename sucks and is imo borderline useless, builtin parameter expansion all the way baby

    Code:
    $ for f in movie1.avi movie2.mp4 music1.mp3; do echo "${f%.*} /// ${f##*.}"; done
    movie1 /// avi
    movie2 /// mp4
    music1 /// mp3

  7. #17
    Join Date
    Sep 2011
    Beans
    180
    Distro
    Ubuntu

    Re: Mencoder - how do I make a script that replace the implements filenames automatic

    Quote Originally Posted by Vaphell View Post
    basename sucks and is imo borderline useless, builtin parameter expansion all the way baby

    Code:
    $ for f in movie1.avi movie2.mp4 music1.mp3; do echo "${f%.*} /// ${f##*.}"; done
    movie1 /// avi
    movie2 /// mp4
    music1 /// mp3
    Quote Originally Posted by SeijiSensei View Post
    Yes, if you're not using lavc then there are no lavcopts.

    That said, I'm not advocating preserving ancient MPEG2 encodings. MPEG2 dates back to the late 1990's and is pretty much only used on traditional DVDs and by some terrestrial HD broadcasters. MPEG4 is considerably more efficient, as your size comparison indicates, and I doubt you could see the difference in video quality on-screen.

    These days the codec of choice is H.264, a variant of MPEG4, which achieves even better compression at equivalent quality. Most streaming sites like YouTube are encoded with H.264 as are most unauthorized video rips out there on the Internet. The drawback of using H.264 is its higher computational demands for decoding. Older hardware with slower CPUs generally can't decode HD H.264 encodes in real time. Modern video cards often include hardware H.264 decoders these days, in particular NVIDIA cards which offer the VDPAU interface. You'll see postings here from time to time complaining that they can't play modern video files on their computers. Usually they're trying to play a 720p or 1080p H.264 encode on computers whose CPUs aren't up to the task.

    I suggest you watch a few minutes of the two files you mentioned above and see if you can detect any obvious quality differences. If not, then I'd stick to MPEG4 or use H.264. Handbrake is a GUI-based DVD ripper and video converter that makes creating H.264 encodes pretty painless. It also handles things like multiple audio and subtitle tracks with ease.
    I'm not new to Handbrake, I just switched over to Ubuntu in August and ever since then I had to make a huge change in how I understood the way cli ties into the system as compared to simple point and click gui - I'm satisfied with my experience in Linux so far, and am much more educated at how the CLI works than I ever was - Handbrake was great, still is to an extent - and back on Windows - when I was using it, I used Handbrake, DvdDecrypter, Slysoft, and then also GordianKnot - so switching to more CLI based programs is a learning experience and I've found does a better job than a fancy GUI - and faster as well, or perhaps thats because it's linux.

    The only thing that I'm unsure of is how change the video codecs I use to encode the videos and incorporate them into common video containers - eg: Using MPEG4 and VBR AAC audio in an .avi container. I know .avi is outdated due to the inventions of .mkv and .mp4 with the H.264 codecs but a lot of multi-media consoles, eg: the Playstation 3 cannot read an .mkv file unless streamed through a media server, where in which it would be encoding in real-time as streaming, or you're running a CFW that allows the format to be ran.

    and at this point in time, I cannot afford a Boxee media box.

  8. #18
    Join Date
    Nov 2008
    Location
    Boston MetroWest
    Beans
    16,326

    Re: Mencoder - how do I make a script that replace the implements filenames automatic

    Your best bet for creating files for the AVI container is to use XviD and MP3. Take a look at that Gentoo howto I linked to above for details on the options needed to do this in mencoder. You won't be able to include soft subs in an AVI container though. You'll have to burn them into the image during re-encoding.

    The Playstation 3 plays .mp4 files with MPEG4 and AAC. Sony, like many media companies, ignores the Matroska container, despite its clear superiority over competing formats, probably because they see it as the preferred choice of those bloody pirates. Not to mention that it wasn't developed by a cartel of media companies the way most codecs and containers have been.
    Last edited by SeijiSensei; April 13th, 2012 at 02:06 PM.

Page 2 of 2 FirstFirst 12

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •