[MPlayer-users] Dumping WMV subs

Diogo Franco diogomfranco at gmail.com
Sat May 24 14:14:23 CEST 2008


Em Sáb, 2008-05-24 às 10:50 +0200, Reimar Döffinger escreveu:
> On Sat, May 24, 2008 at 10:28:12AM +0200, |TEcHNO| wrote:
> > Reimar Döffinger wrote:
> > > mkvmerge can probably extract them. FFmpeg (I think) can do it too, but the format
> > > it produces is probably nothing you can use. With MPlayer you would probably have
> > > to change the source.
> > > To render while encoding, see -vf expand and -sid option.
> > I'm trying something like this below, but the output has no subtitles.
> 
> You are not using the expand filter.
> _______________________________________________
> MPlayer-users mailing list
> MPlayer-users at mplayerhq.hu
> https://lists.mplayerhq.hu/mailman/listinfo/mplayer-users

If you want to extract the subtitle script, the MKVToolnix suite is the
way to go.

If you want to encode subtitles, you have to pass the '-ass' and '-sid
number' options to mencoder. You can get the sids using midentify. I'm
not sure if '-ass' works on mencoder. If it doesn't, you can use named
pipes/fifos and do something like:

ENCODER="mencoder or ffmpeg"
INPUT="The file to be read"
OUTPUT="The encoded file"
MPLAYERFILTERS="Video filters for the decoding instance"
SUB_ID="The subtitle id to pass to the decoding instance"
FILTERS="The filters to pass to mencoder"
OPTIONS="The -lavcopts on mencoder or ffmpeg options."

# You can use both mencoder/ffmpeg to encode and get the same results.

# I use 'y4m' as the extension because x264 only accepts pipes
# with this extension, and I use it sometimes.
mkfifo "fifo.y4m"

# Run mplayer, filtering and subbing the video and dumping it to a fifo.
mplayer "$INPUT" -ass -vf "$MPLAYERFILTERS" -ao null \
	-vo yuv4mpeg:file=fifo.y4m -sid "$SUB_ID" -really-quiet &

# Nor read the fifo, read audio from the original file and encode.
if [ "$ENCODER" = mencoder ]; then
	# MEncoder way
	mencoder -demuxer y4m "fifo.y4m" -audio-demuxer lavf \
		-audiofile "$INPUT" -ovc lavc -oac lavc \
		-vf "$FILTERS" -lavcopts "$OPTIONS" -o "$OUTPUT"
else
	# FFMpeg way
	ffmpeg -f yuv4mpegpipe -i "fifo.y4m" -i "$INPUT" \
		"$OPTIONS" "$OUTPUT"
fi




More information about the MPlayer-users mailing list