[MEncoder-users] Encode with -ass

RVM rvm3000 at ya.com
Sun Oct 21 02:13:17 CEST 2007


El Sábado, 20 de Octubre de 2007 22:37, Moritz Barsnick escribió:
> Hi RVM,
>
> On Sat, Oct 20, 2007 at 02:20:10 +0200, RVM wrote:
> > mkfifo stream.yuv | mplayer -ass -sub subtitle.ass -vo yuv4mpeg file.avi
>
>                     ^
> That pipe should be a semicolon instead, IMO.

I don't know. But it works this way.

> > mencoder stream.yuv <options> -o fileout.avi
> >
> > But, what happens with the audio? When I run those commands I can hear
> > the audio through the speakers, and the encoded video has no audio. I
> > guess the audio stream should also be redirected to the fifo, but how?
>
> I don't think mplayer can multiplex audio and video. My guess would be:
> > mkfifo stream.yuv; mkfifo stream.pcm
> > mplayer -ass -aub subtitle.ass -vo yuv4mpeg -ao pcm:file=stream.pcm
> > file.avi mencoder stream.yuv -audiofile stream.pcm <options> -o
> > fileout.avi
>
> Totally untested. I don't know about sync issues though, but this might
> be worth a try.
>
> You could also use mplayer's "-dumpaudio -dumpfile stream.pcm" and get
> the original encoded audio, and reuse it in mencoder with "-oac copy".

At the end I used an script like this:

#!/bin/sh

FILE=../2x02.avi
SUBS=../2x02.srt

FILE_OUT=video_02.avi


MPLAYER=~/smplayer/mplayer-r24815/mplayer
#MENCODER=~/smplayer/mplayer-r24815/mencoder
MENCODER=/usr/bin/mencoder

SUB_OPTIONS="-ass -ass-color ffff4000 \
             -ass-border-color 00000000 \
             -ass-force-style Bold=1,Outline=2,Shadow=3,Fontsize=19 \
             -fontconfig -subcp ISO-8859-1 -ass-line-spacing 0"

# Extract audio
$MPLAYER  $FILE -dumpaudio -dumpfile audio_out

# Extract video
mkfifo stream.yuv | $MPLAYER $SUB_OPTIONS $FILE -font "Arial Black" \
                             -sub $SUBS -vo yuv4mpeg -nosound -noframedrop \
                             -quiet -benchmark &

$MENCODER -noodml -audiofile audio_out -mc 0 -noquiet -o $FILE_OUT \
  -oac copy -ovc xvid \
  -xvidencopts bitrate=1166:quant_type=h263:max_bframes=2 \
  -vf-add harddup \
  stream.yuv

# Clean
rm audio_out
rm stream.yuv


But there's a problem. It seems newer versions of mencoder can't open 
stream.yuv (mencoder from v.1.0rc1 works ok):

MEncoder dev-SVN-r24815-3.3.4 (C) 2000-2007 MPlayer Team
CPU: AMD Athlon(tm) 64 Processor 3400+ (Family: 15, Model: 4, Stepping: 10)
CPUflags: Type: 15 MMX: 1 MMX2: 1 3DNow: 1 3DNow2: 1 SSE: 1 SSE2: 1
Compiled for x86 CPU with extensions: MMX MMX2 3DNow 3DNowEx SSE SSE2

Configuration: --disable-tv --disable-tv-teletext --disable-radio-v4l2 
--disable-v4l2
init_freetype
get_path('font/font.desc') -> '/home/ricardo/.mplayer/font/font.desc'
font: can't open file: /home/ricardo/.mplayer/font/font.desc
Bitmap font /usr/local/share/mplayer/font/font.desc loaded successfully! (206 
chars)
Using MMX (with tiny bit MMX2) Optimized OnScreenDisplay
mplayer: could not connect to socket
mplayer: Permission denied
[file] File size is -1 bytes
STREAM: [file] stream.yuv
STREAM: Description: File
STREAM: Author: Albeu
STREAM: Comment: based on the code from ??? (probably Arpi)
success: format: 0  data: 0x0 - 0x0
[file] File size is 41597664 bytes
STREAM: [file] audio_out
STREAM: Description: File
STREAM: Author: Albeu
STREAM: Comment: based on the code from ??? (probably Arpi)
LAVF_check: YUV4MPEG pipe format
Cannot seek backward in linear streams!
Seek failed
Cannot seek backward in linear streams!
Seek failed
Checking for YUV4MPEG2
Cannot seek backward in linear streams!
Seek failed
ASF_check: not ASF guid!
Cannot seek backward in linear streams!
Seek failed
Checking for NuppelVideo
Cannot seek backward in linear streams!
Seek failed
Checking for REAL
Cannot seek backward in linear streams!
Seek failed
Checking for SMJPEG
Cannot seek backward in linear streams!
Seek failed
Cannot seek backward in linear streams!
Seek failed
Cannot seek backward in linear streams!
Seek failed
Cannot seek backward in linear streams!
Seek failed
Cannot seek backward in linear streams!
Seek failed
Searching demuxer type for filename stream.yuv ext: .yuv
Cannot seek backward in linear streams!
Seek failed
Checking for Nullsoft Streaming Video
Cannot seek backward in linear streams!
Seek failed
Checking for MOV
Cannot seek backward in linear streams!
Seek failed
Checking for VIVO
header block 1 size: 70
Cannot seek backward in linear streams!
Seek failed
Cannot seek backward in linear streams!
Seek failed
Cannot seek backward in linear streams!
Seek failed
Cannot seek backward in linear streams!
Seek failed
Cannot seek backward in linear streams!
Seek failed
AVS: avs_check_file - attempting to open file stream.yuv
Win32 LoadLibrary failed to load: 
avisynth.dll, /usr/lib/codecs/avisynth.dll, /usr/lib/win32/avisynth.dll, /usr/local/lib/win32/avisynth.dll
AVS: failed to load avisynth.dll
AVS: Init failed
Cannot seek backward in linear streams!
Seek failed
Checking for PVA
Cannot seek backward in linear streams!
Seek failed
Checking for MPEG-TS...
THIS DOESN'T LOOK LIKE AN MPEG-TS FILE!
TRIED UP TO POSITION 0, FOUND 10, packet_size= 0, SEEMS A TS? 0
Cannot seek backward in linear streams!
Seek failed
Cannot seek backward in linear streams!
Seek failed
Checking for LMLM4 Stream Format
Invalid packet in LMLM4 stream: ch=4112 size=269488136
LMLM4 Stream Format not found
Cannot seek backward in linear streams!
Seek failed
MPEG Stream reached EOF
ds_fill_buffer: EOF reached (stream: video)
MPEG packet stats: p100: 0  p101: 0 p1B6: 0 p12x: 0 sli: 0 a: 0 b: 0 c: 0 idr: 
0 sps: 0 pps: 0 PES: 0  MP3: 0, synced: 0
Not MPEG System Stream format... (maybe Transport Stream?)
Cannot seek backward in linear streams!
Seek failed
stream_seek: WARNING! Can't seek to 0x0 !
stream_seek: WARNING! Can't seek to 0x0 !
MPEG Stream reached EOF
ds_fill_buffer: EOF reached (stream: video)
MPEG packet stats: p100: 0  p101: 0 p1B6: 0 p12x: 0 sli: 0 a: 0 b: 0 c: 0 idr: 
0 sps: 0 pps: 0 PES: 0  MP3: 0, synced: 3
Not MPEG System Stream format... (maybe Transport Stream?)
stream_seek: WARNING! Can't seek to 0x0 !
stream_seek: WARNING! Can't seek to 0x0 !
stream_seek: WARNING! Can't seek to 0x0 !
ds_fill_buffer: EOF reached (stream: video)
stream_seek: WARNING! Can't seek to 0x0 !
stream_seek: WARNING! Can't seek to 0x0 !
Checking for DV
stream_seek: WARNING! Can't seek to 0x0 !
demux_aac_probe, failed to detect an AAC stream
============ Sorry, this file format is not recognized/supported =============
=== If this file is an AVI, ASF or MPEG stream, please contact the author! ===
Cannot open demuxer.

Exiting...



-- 
RVM



More information about the MEncoder-users mailing list