[MEncoder-users] MEncoder Creating "Snip-Its" of Audio, Video, and Subtitle files

Christopher Hunt chunt102783 at gmail.com
Tue Jun 11 19:03:45 CEST 2013

I'm experiencing some odd behavior when using a combination of MEncoder and
ffmpeg to create short clips of media files (specifically in QuickTime mov
containers).  The end result that I'm trying to achieve is a single output
QuickTime mov file from a combination of an input QuickTime file and
optionally an External Sub and/or an External Audio File, however I am not
trying to mux the external subtitle file into the mov container but rather
burn those subtitles into the video stream.  What I'm experiencing is
seemingly random playback success, e.g. if I create a Snip-It from a prores
mov file that is less than 60 seconds in length the output file is not
playable in QuickTimePro 7 but is in VLC and and equally so in MPlayer, but
in VLC the playback duration reads as 1 minute.  Alternatively if the input
file contains an MJPEG video stream then the output file of a less than 60
second clip is playable in QuickTimePro 7.  But Depending on the exact
value used for the duration of the clip the playback in QuickTimePro 7 and
VLC show a different duration and playback correctly until it reaches the
time in the file that was the duration as passed to MEncoder then the image
is distorted but resembles images found in the clip (the audio behaves
similarly). I'm using the following command line to extract these Snip-Its:

# These are the same arguments passed to MPlayer from UMPlayer when loading
the video/audio/subtitle combination
extra_args="-lavdopts threads=8 -ass -msglevel ass=6 -embeddedfonts
-ass-line-spacing 0 -ass-font-scale 1 -ass-styles
~/.config/umplayer/styles.ass -fontconfig -font Arial -subfont-autoscale 0
-subfont-osd-scale 20 -subfont-text-scale 20 -subcp UTF-8 -aid 0 -subpos
100 -noslices -channels 6 -af scaletempo -demuxer lavf -ass -fontconfig
-subcp UTF-8 -audiofile-cache 65535 -cache-min 50"

# Extract the video and burn in the subtitles from the external subtitle
./mencoder $extra_args -nosound -ss <start_time> -endpos <duration>
<input_video_file> <input_subtitle_file> -o "video_stream.avi" -ovc lavc

# This copies the audio tracks out of the External Audio File or if the
audio is contained in the same file as the video it is extracted
# from there ($map_vals is the -map 0:# ... where # is the (zero-based)
index of the audio stream within the file

./ffmpeg -y -threads 0 -ss <start_time> -t <duration> -i <input_audio_file>
$map_vals -c copy "audio_streams.mov"

# This combines the video stream and audio stream into one QuickTime file
./ffmpeg -y -threads 0 -i "video_stream.avi" -i "audio_streams.mov" -map 0
-map 1 -c copy "output_file.mov"

Some additional details:

MPlayer/MEncoder was built on an Intel Mac running OSX 10.7.5 with the
following configure

./configure '--cc=clang' --enable-decoder=vda --disable-sortsub
--extra-cflags="-mmacosx-version-min=10.6 -Wno-typedef-redefinition"
--extra-ldflags="-mmacosx-version-min=10.6" --enable-mencoder
--extra-libs="-lssl -lcrypto -lzip"

ffmpeg was built with the following configure

./configure --enable-openssl --enable-nonfree --enable-postproc
--enable-gpl --arch=x86_64  --enable-libfreetype

It would be preferable that all this was done in a single step (ideally
through MEncoder) but as I need the ffmpeg muxer to create a valid
QuickTime file as the output and MEncoder's use of -of lavf option is
broken I can't.  Any help or pointers to solutions/possible workarounds
would be greatly appreciated.



More information about the MEncoder-users mailing list