Results 1 to 9 of 9

Thread: mplayer and x264 encodeing

  1. #1
    Join Date
    Apr 2009
    Location
    USA
    Beans
    23
    Distro
    Xubuntu

    Question mplayer and x264 encodeing

    I found x264 Encoding Guide - Linux Encoding after following the instructions there i ended up with the following bash script :

    Code:
    #!/bin/bash
    vidfile='/home/wolfpup/Videos/<series folder>/<series ep>.mkv'
    mplayer -nosound -benchmark -ass -vo yuv4mpeg:file=>(x264 --demuxer y4m --profile high --level 4.1 --crf 18 --preset veryslow --tune animation --deblock -2:-2 --psy-rd -0.60:0 --qpmin 10 --qpmax 28 --aq-mode 2 --no-mbtree --threads auto --output $vidfile.264 video.y4m 2>&1 | tee $vidfile-x264.log) $vidfile
    This script generates the following error :

    Code:
    x264 [error]: could not open input file `video.y4m'
    MPlayer2 UNKNOWN (C) 2000-2011 MPlayer Team
    mplayer: could not connect to socket
    mplayer: No such file or directory
    Failed to open LIRC support. You will not be able to use your remote control.
    
    Playing /home/wolfpup/Videos/<series folder>/<series ep>.mkv.
    [mkv] Track ID 1: video (V_MPEG4/ISO/AVC), -vid 0
    [mkv] Track ID 2: audio (A_AAC), -aid 0, -alang und
    [mkv] Track ID 3: subtitles (S_TEXT/ASS), -sid 0, -slang und
    [mkv] Will play video track 1.
    Detected file format: Matroska
    VIDEO:  [avc1]  1280x720  24bpp  23.810 fps    0.0 kbps ( 0.0 kbyte/s)
    Load subtitles in /home/wolfpup/Videos/<series folder>/
    Using (default) progressive frame mode.
    [ass] auto-open
    ==========================================================================
    Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
    Asking decoder to use 2 threads if supported.
    Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
    ==========================================================================
    Audio: no sound
    Starting playback...
    V:   0.0   0/  0 ??% ??% ??,?% 0 0 [K V:   0.0   0/  0 ??% ??% ??,?% 0 0 [K V:   0.0   0/  0 ??% ??% ??,?% 0 0 [K 
    Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
    VO: [yuv4mpeg] 1280x720 => 1280x720 Planar YV12 
    
    
    MPlayer interrupted by signal 13 in module: check_framedrop
    Colorspace details not fully supported by selected vo.
    
    
    MPlayer interrupted by signal 13 in module: unknown
    Here is what I eventually want the script to fully do:

    1. encode the video adding hardsubs to video
    2. encode audio if needed( eg flac/pcm -> aac) ( can be commented out if not needed).
    3. extract chapters file from mkv and audio if not encoded in previous step.
    4. mux new video, audio, and chapters file into and mp4 container.


    Right now I can not get the video to encode so I'm currently stuck.

    ANY help will be GREATLY welcomed.
    Last edited by Wolfpup; February 5th, 2013 at 03:08 AM. Reason: made series folder and ep name more generic

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

    Re: mplayer and x264 encodeing

    As its name implies, mplayer is a player, not an encoder. I don't know what you are reading, but mplayer is not designed to encode videos.

    You might take a look at ffmpeg or avconv.

    Also I'd recommend that you not include the names of infringing video files like the one you list here. (Not to mention that HS is one of the worst examples of leeching in recent memory considering they don't even do their own translations but just steal them from Crunchyroll.)
    If you ask for help, do not abandon your request. Please have the courtesy to check for responses and thank the people who helped you.

    Blog · Linode System Administration Guides · Android Apps for Ubuntu Users

  3. #3
    Join Date
    Apr 2009
    Location
    USA
    Beans
    23
    Distro
    Xubuntu

    Re: mplayer and x264 encodeing

    Quote Originally Posted by SeijiSensei View Post
    As its name implies, mplayer is a player, not an encoder. I don't know what you are reading, but mplayer is not designed to encode videos.

    You might take a look at ffmpeg or avconv.

    Also I'd recommend that you not include the names of infringing video files like the one you list here. (Not to mention that HS is one of the worst examples of leeching in recent memory considering they don't even do their own translations but just steal them from Crunchyroll.)
    I know mplayer is not an encoder that is what x264 is for please look as the FULL cmd line.
    I am 'playing' the video+subs into x264 and x264 is doing the encoding.
    Also ffmpeg so not have the ability for allowing you to add the subs to the video stream unless you have a 'frame server' which is what I'm using mplayer for.

  4. #4
    Join Date
    Mar 2012
    Beans
    308

    Re: mplayer and x264 encodeing

    Quote Originally Posted by Wolfpup View Post
    Code:
    x264 [error]: could not open input file `video.y4m'
    ...
    Are you sure that this non-existing file should be used as input source instead of the pipe from mplayer ( - )?
    GNU/Linux

  5. #5
    Join Date
    Sep 2006
    Beans
    3,713

    Re: mplayer and x264 encodeing

    Quote Originally Posted by Wolfpup View Post
    Old. You no longer need to use mplayer to pipe to x264; it can handle any input that ffmpeg supports. You need to enable lavf support in x264 (basically you install x264 then ffmpeg then x264 again if you want both ffmpeg to support libx264 and x264 to support lavf). Search lavf in How To Compile FFmpeg and x264 on Ubuntu.

    Or you could just use ffmpeg.

    Quote Originally Posted by Wolfpup
    Here is what I eventually want the script to fully do:
    1. encode the video adding hardsubs to video
    2. encode audio if needed( eg flac/pcm -> aac) ( can be commented out if not needed).
    3. extract chapters file from mkv and audio if not encoded in previous step.
    4. mux new video, audio, and chapters file into and mp4 container.
    A good start:
    Code:
    ffmpeg -i input -c:v libx264 -preset veryslow -tune animation -crf 18 \
    -vf subtitles=subtitle.srt -c:a libfdk_aac -vbr 5 output.mkv
    You will have to figure out how to extract the srt and how to deal with chapters. The bizarro "ffmpeg" from the repo does not have the subtitles filter so you will need to compile as shown in the link I provided above.

    Also see:
    Last edited by FakeOutdoorsman; February 5th, 2013 at 03:54 AM.

  6. #6
    Join Date
    Apr 2009
    Location
    USA
    Beans
    23
    Distro
    Xubuntu

    Cool Re: mplayer and x264 encodeing

    Quote Originally Posted by FakeOutdoorsman View Post
    Old. You no longer need to use mplayer to pipe to x264; it can handle any input that ffmpeg supports. You need to enable lavf support in x264 (basically you install x264 then ffmpeg then x264 again if you want both ffmpeg to support libx264 and x264 to support lavf). Search lavf in How To Compile FFmpeg and x264 on Ubuntu.

    Or you could just use ffmpeg.



    A good start:
    Code:
    ffmpeg -i input -c:v libx264 -preset veryslow -tune animation -crf 18 \
    -vf subtitles=subtitle.srt -c:a libfdk_aac -vbr 5 output.mkv
    You will have to figure out how to extract the srt and how to deal with chapters. The bizarro "ffmpeg" from the repo does not have the subtitles filter so you will need to compile as shown in the link I provided above.

    Also see:
    After following the above instructions i do have it semi encoding the mp4.
    I had to convert :
    Code:
    mplayer -nosound -benchmark -ass -vo yuv4mpeg:file=>(x264 --demuxer y4m --profile high --level 4.1 --crf 18 --preset veryslow --tune animation --deblock -2:-2 --psy-rd -0.60:0 --qpmin 10 --qpmax 28 --aq-mode 2 --no-mbtree --threads auto --output $vidfile.264 video.y4m 2>&1 | tee $vidfile-x264.log) $vidfile
    To:
    Code:
    ffmpeg -i $vidfile.mkv -c:v libx264 -profile:v high -level 4.1 -crf 18 -preset veryslow -tune animation -deblock -2:-2 -x264opts qpmin=10:qpmax=28:aq-mode=2:no-mbtree:threads=auto -c:a copy $vidfile.mp4 2>&1 | tee $vidfile-enc.log
    this dose do the video re-encoeing BUT it dose not include the subs wich are embeded in the mkv container. So next step is to figure out how to extrat the fonts and install them plus extract the subs which are advanced subtitle scripting. i wouls like to be able to do this all automatically so that i can put the script in a bin folder and then just use a simple command to do all the processing for a given video file.

  7. #7
    Join Date
    Oct 2010
    Location
    London
    Beans
    482
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: mplayer and x264 encodeing

    To extract subtitles:

    Code:
    ffmpeg -i input.mkv -map 0:s:0 subtitle.srt
    This will extract the first subtitle stream (ffmpeg begins counting at 0). If you have multiple subtitle languages & want to extract the second stream, use `-map 0:s:1`.

    If you have Advanced Substation Alpha subtitles, you should use `subtitle.ass` as the output.

    The instructions on how to hardcode the subtitles, once they are in a separate file, are clearly laid out in that guide fakeoutdoorsman linked to.

  8. #8
    Join Date
    Apr 2009
    Location
    USA
    Beans
    23
    Distro
    Xubuntu

    Cool Re: mplayer and x264 encodeing

    Quote Originally Posted by evilsoup View Post
    To extract subtitles:

    Code:
    ffmpeg -i input.mkv -map 0:s:0 subtitle.srt
    This will extract the first subtitle stream (ffmpeg begins counting at 0). If you have multiple subtitle languages & want to extract the second stream, use `-map 0:s:1`.

    If you have Advanced Substation Alpha subtitles, you should use `subtitle.ass` as the output.

    The instructions on how to hardcode the subtitles, once they are in a separate file, are clearly laid out in that guide fakeoutdoorsman linked to.
    i want the subs to be burned into the video preferably with out having to extract them plus there are fonts in the file that are included in the mkv. and there is also the chapters that would need to be added to the mp4 from the mkv.
    Last edited by Wolfpup; February 6th, 2013 at 02:04 AM.

  9. #9
    Join Date
    Sep 2006
    Beans
    3,713

    Re: mplayer and x264 encodeing

    Why no-mbtree?

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
  •