[FFmpeg-user] disable auto select audio stream

Максим Варенцов mete0 at phpcode.us
Fri Oct 5 15:10:24 CEST 2012


Hi.

I have minidlna server with patches for transcoding. For transcoding i
use ffmpeg and have no idea how i can switch audio stream.

Transcoding script:

> #!/bin/sh
> SOURCE=$1
> STARTPOSITION=$2
> DURATION=$3
> ffmpeg -ss $STARTPOSITION -t $DURATION -i "$SOURCE" -loglevel quiet -threads 4 -async 2 -target pal-dvd pipe:1


example of source:
$ ffmpeg -i /media/sample.mkv
ffmpeg version git-N-31885-g84ffe14, Copyright (c) 2000-2011 the
FFmpeg developers
  built on Aug 25 2012 15:34:33 with gcc 4.2.1 20070719
  configuration: --enable-shared --arch=amd64 --cc=cc
--disable-altivec --disable-armv5te --disable-armv6 --disable-armv6t2
--disable-armvfp --disable-debug --disable-indev=jack
--disable-indev=oss --disable-iwmmxt --disable-neon
--disable-outdev=oss --disable-outdev=sdl --enable-gpl --enable-libgsm
--enable-libmp3lame --enable-libschroedinger --enable-libspeex
--enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264
--enable-libxvid --enable-runtime-cpudetect --enable-x11grab
--extra-cflags='-I/usr/local/include -I/usr/X11R6/include'
--extra-libs='-L/usr/local/lib -L/usr/X11R6/lib'
--mandir=/usr/local/man
  libavutil    50. 43. 0 / 50. 43. 0
  libavcodec   52.123. 0 / 52.123. 0
  libavformat  52.111. 0 / 52.111. 0
  libavdevice  52.  5. 0 / 52.  5. 0
  libavfilter   1. 80. 0 /  1. 80. 0
  libswscale    0. 14. 1 /  0. 14. 1
  libpostproc  51.  2. 0 / 51.  2. 0
[matroska,webm @ 0x20b0a2000] Estimating duration from bitrate, this
may be inaccurate
Seems stream 0 codec frame rate differs from container frame rate:
47.95 (5994/125) -> 23.98 (24000/1001)
Input #0, matroska,webm, from '/media/sample.mkv':
  Duration: 00:21:21.56, start: 0.000000, bitrate: 768 kb/s
    Stream #0.0: Video: h264 (High), yuv420p, 1280x720 [PAR 1:1 DAR
16:9], 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
    Stream #0.1: Audio: ac3, 44100 Hz, stereo, s16, 384 kb/s *(default)*
    Stream #0.2: Audio: ac3, 48000 Hz, stereo, s16, 384 kb/s

So, default audio stream have language what i need, but ffmepg select
stream #0.2.

Documentation said me: http://ffmpeg.org/ffmpeg.html#Stream-selection
By default ffmpeg includes only one stream of each type... for audio
the stream with the most channels... (looks like best quality?).

How i can said ffmpeg use *default* audio stream? Or just said always
select first audio-stream?

Thanks.


More information about the ffmpeg-user mailing list