[FFmpeg-user] [HELP] ffmpeg how to arrange video , audio to the specific stream

Soho Soho123 soho123.2012 at gmail.com
Tue Aug 6 09:52:55 CEST 2013


2013/8/6 Carl Eugen Hoyos <cehoyos at ag.or.at>

> Soho Soho123 <soho123.2012 <at> gmail.com> writes:
>
> > # ffmpeg -loglevel debug -f video4linux2 -r 30
> > -s 640x480 -input_format h264 -i /dev/video1
> > -f alsa -ar 48000 -ac 2 -i hw:0 -vcodec copy
> > -acodec copy -map 0:0 -> map 0:1
> > http://localhost:8090/feed1.ffm
> > ffmpeg version 2.0
>
> Please update to current git head.
>
>
Why you recommend git head ?
Is "map" not function in version 2.0 not?
the git head version  is cheanged frequently.
it is not convenient for me to do verification.




>
> > Applying option map (set input stream mapping) with argument 0:1.
> > Stream map '0:1' matches no streams.
>
> Use "-map 1:0" instead of "-map 0:1"
>

the result seems does not get any change about stream arrangement.
the log is :

ffmpeg -loglevel debug -f video4linux2 -r 30 -s 640x480 -input_format h264
-i
/dev/video1 -f alsa -ar 48000 -ac 2 -i hw:0 -vcodec copy -acodec copy -map
1:0 -
map 0:0 http://localhost:8090/feed1.ffm
ffmpeg version 2.0 Copyright (c) 2000-2013 the FFmpeg developers
  built on Aug  6 2013 13:22:29 with gcc 4.4.5-1.5.5p4 (GCC)
  configuration: --enable-cross-compile --cross-prefix=sdk-linux-
--arch=mips --target-os=linux --disable-doc --disable-htmlpages
--disable-manpages --disable-podpages --disable-txtpages --disable-mips32r2
--disable-ffplay --disable-postproc --disable-runtime-cpudetect
--disable-swscale-alpha --disable-mipsdspr1 --disable-mipsdspr2
--disable-mipsfpu --enable-small --prefix=/ffmpeg-2.0/romfs
--bindir=/ffmpeg-2.0/romfs --disable-bsfs --disable-filters --enable-gpl
--enable-libfaac --enable-nonfree --enable-libx264
--extra-cflags=-I/ShareLib_Install/bin/../include
--extra-libs='-L/ShareLib_Install/bin/../lib -lx264'
--enable-filter='aformat,aresample,anull,copy,format,fps,framestep,resample'
libavutil      52. 38.100 / 52. 38.100
  libavcodec     55. 18.102 / 55. 18.102
  libavformat    55. 12.100 / 55. 12.100
  libavdevice    55.  3.100 / 55.  3.100
  libavfilter     3. 79.101 /  3. 79.101
  libswscale      2.  3.100 /  2.  3.100
  libswresample   0. 17.102 /  0. 17.102
Splitting the commandline.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging
level) with argument 'debug'.
Reading option '-f' ... matched as option 'f' (force format) with argument
'video4linux2'.
Reading option '-r' ... matched as option 'r' (set frame rate (Hz value,
fraction or abbreviation)) with argument '30'.
Reading option '-s' ... matched as option 's' (set frame size (WxH or
abbreviation)) with argument '640x480'.
Reading option '-input_format' ... matched as AVOption 'input_format' with
argument 'h264'.
Reading option '-i' ... matched as input file with argument '/dev/video1'.
Reading option '-f' ... matched as option 'f' (force format) with argument
'alsa'.
Reading option '-ar' ... matched as option 'ar' (set audio sampling rate
(in Hz)) with argument '48000'.
Reading option '-ac' ... matched as option 'ac' (set number of audio
channels) with argument '2'.
Reading option '-i' ... matched as input file with argument 'hw:0'.
Reading option '-vcodec' ... matched as option 'vcodec' (force video codec
('copy' to copy stream)) with argument 'copy'.
Reading option '-acodec' ... matched as option 'acodec' (force audio codec
('copy' to copy stream)) with argument 'copy'.
Reading option '-map' ... matched as option 'map' (set input stream
mapping) with argument '1:0'.
Reading option '-map' ... matched as option 'map' (set input stream
mapping) with argument '0:0'.
Reading option 'http://localhost:8090/feed1.ffm' ... matched as output file.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option loglevel (set logging level) with argument debug.
Successfully parsed a group of options.
Parsing a group of options: input file /dev/video1.
Applying option f (force format) with argument video4linux2.
Applying option r (set frame rate (Hz value, fraction or abbreviation))
with argument 30.
Applying option s (set frame size (WxH or abbreviation)) with argument
640x480.
Successfully parsed a group of options.
Opening an input file: /dev/video1.
[video4linux2,v4l2 @ 0x71ed40] fd:3 capabilities:4000001
[video4linux2,v4l2 @ 0x71ed40] Current input_channel: 0, input_name: Camera
1
[video4linux2,v4l2 @ 0x71ed40] Setting time per frame to 1/30
[h264 @ 0x71f9a0] Frame num gap 8 6
[video4linux2,v4l2 @ 0x71ed40] All info found
Input #0, video4linux2,v4l2, from '/dev/video1':
  Duration: N/A, start: 40.820000, bitrate: N/A
    Stream #0:0, 8, 1/1000000: Video: h264, yuv420p, 640x480, 1/2000000, -5
kb/s, 30 fps, 30 tbr, 1000k tbn, 2000k tbc
Successfully opened the file.
Parsing a group of options: input file hw:0.
Applying option f (force format) with argument alsa.
Applying option ar (set audio sampling rate (in Hz)) with argument 48000.
Applying option ac (set number of audio channels) with argument 2.
Successfully parsed a group of options.
Opening an input file: hw:0.
[alsa @ 0x816250] All info found
Guessed Channel Layout for  Input Stream #1.0 : stereo
Input #1, alsa, from 'hw:0':
  Duration: N/A, start: 1375803007.838875, bitrate: N/A
    Stream #1:0, 1, 1/1000000: Audio: pcm_s16be, 48000 Hz, stereo, 1536 kb/s
Successfully opened the file.
Parsing a group of options: output file http://localhost:8090/feed1.ffm.
Applying option vcodec (force video codec ('copy' to copy stream)) with
argument copy.
Applying option acodec (force audio codec ('copy' to copy stream)) with
argument copy.
Applying option map (set input stream mapping) with argument 1:0.
Applying option map (set input stream mapping) with argument 0:0.
Successfully parsed a group of options.
Opening an output file: http://localhost:8090/feed1.ffm.
[ffm @ 0x7a43f0] Format ffm probed with size=2048 and score=101
[AVIOContext @ 0x7a4900] Statistics: 4096 bytes read, 0 seeks
Tue Aug  6 15:30:07 2013 127.0.0.1 - - [GET] "/feed1.ffm HTTP/1.1" 200 4175
Successfully opened the file.
Output #0, ffm, to 'http://localhost:8090/feed1.ffm':
  Metadata:
    creation_time   : now
    encoder         : Lavf55.12.100
    Stream #0:0, 0, 1/1000000: Audio: pcm_s16be, 48000 Hz, stereo, 1536 kb/s
    Stream #0:1, 0, 1/1000000: Video: h264, yuv420p, 640x480, 1/30, q=2-31,
-5 kb/s, 30 fps, 1000k tbn, 30 tbc
Stream mapping:
  Stream #1:0 -> #0:0 (copy)
  Stream #0:0 -> #0:1 (copy)
Press [q] to stop, [?] for help

================================================================
and
# ffmpeg -loglevel debug -f video4linux2 -r 30 -s 640x480 -input_format
h264 -i
/dev/video1 -f alsa -ar 48000 -ac 2 -i hw:0 -vcodec copy -acodec copy -map
0:0 -
map 1:0 http://localhost:8090/feed1.ffm
ffmpeg version 2.0 Copyright (c) 2000-2013 the FFmpeg developers
  built on Aug  6 2013 13:22:29 with gcc 4.4.5-1.5.5p4 (GCC)
  configuration: --enable-cross-compile --cross-prefix=sdk-linux-
--arch=mips --target-os=linux --disable-doc --disable-htmlpages
--disable-manpages --disable-podpages --disable-txtpages --disable-mips32r2
--disable-ffplay --disable-postproc --disable-runtime-cpudetect
--disable-swscale-alpha --disable-mipsdspr1 --disable-mipsdspr2
--disable-mipsfpu --enable-small --prefix=/ffmpeg-2.0/romfs
--bindir=/ffmpeg-2.0/romfs --disable-bsfs --disable-filters --enable-gpl
--enable-libfaac --enable-nonfree --enable-libx264
--extra-cflags=-I/ShareLib_Install/bin/../include
--extra-libs='-L/ShareLib_Install/bin/../lib -lx264'
--enable-filter='aformat,aresample,anull,copy,format,fps,framestep,resample'
libavutil      52. 38.100 / 52. 38.100
  libavcodec     55. 18.102 / 55. 18.102
  libavformat    55. 12.100 / 55. 12.100
  libavdevice    55.  3.100 / 55.  3.100
  libavfilter     3. 79.101 /  3. 79.101
  libswscale      2.  3.100 /  2.  3.100
  libswresample   0. 17.102 /  0. 17.102
Splitting the commandline.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging
level) with argument 'debug'.
Reading option '-f' ... matched as option 'f' (force format) with argument
'video4linux2'.
Reading option '-r' ... matched as option 'r' (set frame rate (Hz value,
fraction or abbreviation)) with argument '30'.
Reading option '-s' ... matched as option 's' (set frame size (WxH or
abbreviation)) with argument '640x480'.
Reading option '-input_format' ... matched as AVOption 'input_format' with
argument 'h264'.
Reading option '-i' ... matched as input file with argument '/dev/video1'.
Reading option '-f' ... matched as option 'f' (force format) with argument
'alsa'.
Reading option '-ar' ... matched as option 'ar' (set audio sampling rate
(in Hz)) with argument '48000'.
Reading option '-ac' ... matched as option 'ac' (set number of audio
channels) with argument '2'.
Reading option '-i' ... matched as input file with argument 'hw:0'.
Reading option '-vcodec' ... matched as option 'vcodec' (force video codec
('copy' to copy stream)) with argument 'copy'.
Reading option '-acodec' ... matched as option 'acodec' (force audio codec
('copy' to copy stream)) with argument 'copy'.
Reading option '-map' ... matched as option 'map' (set input stream
mapping) with argument '0:0'.
Reading option '-map' ... matched as option 'map' (set input stream
mapping) with argument '1:0'.
Reading option 'http://localhost:8090/feed1.ffm' ... matched as output file.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option loglevel (set logging level) with argument debug.
Successfully parsed a group of options.
Parsing a group of options: input file /dev/video1.
Applying option f (force format) with argument video4linux2.
Applying option r (set frame rate (Hz value, fraction or abbreviation))
with argument 30.
Applying option s (set frame size (WxH or abbreviation)) with argument
640x480.
Successfully parsed a group of options.
Opening an input file: /dev/video1.
[video4linux2,v4l2 @ 0x71ed40] fd:3 capabilities:4000001
[video4linux2,v4l2 @ 0x71ed40] Current input_channel: 0, input_name: Camera
1
[video4linux2,v4l2 @ 0x71ed40] Setting time per frame to 1/30
[video4linux2,v4l2 @ 0x71ed40] All info found
Input #0, video4linux2,v4l2, from '/dev/video1':
  Duration: N/A, start: 497.140000, bitrate: N/A
    Stream #0:0, 8, 1/1000000: Video: h264, yuv420p, 640x480, 1/2000000, -5
kb/s, 30 fps, 30 tbr, 1000k tbn, 2000k tbc
Successfully opened the file.
Parsing a group of options: input file hw:0.
Applying option f (force format) with argument alsa.
Applying option ar (set audio sampling rate (in Hz)) with argument 48000.
Applying option ac (set number of audio channels) with argument 2.
Successfully parsed a group of options.
Opening an input file: hw:0.
[alsa @ 0x7fe4d0] audio_device=hw:0
[alsa @ 0x7fe4d0] codec_id ==NONE
[alsa @ 0x7fe4d0] Do RECORD,1
[alsa @ 0x7fe4d0] All info found
Guessed Channel Layout for  Input Stream #1.0 : stereo
Input #1, alsa, from 'hw:0':
  Duration: N/A, start: 1375803463.588875, bitrate: N/A
    Stream #1:0, 1, 1/1000000: Audio: pcm_s16be, 48000 Hz, stereo, 1536 kb/s
Successfully opened the file.
Parsing a group of options: output file http://localhost:8090/feed1.ffm.
Applying option vcodec (force video codec ('copy' to copy stream)) with
argument copy.
Applying option acodec (force audio codec ('copy' to copy stream)) with
argument copy.
Applying option map (set input stream mapping) with argument 0:0.
Applying option map (set input stream mapping) with argument 1:0.
Successfully parsed a group of options.
Opening an output file: http://localhost:8090/feed1.ffm.
[ffm @ 0x808ea0] Format ffm probed with size=2048 and score=101
[AVIOContext @ 0x809400] Statistics: 4096 bytes read, 0 seeks
Tue Aug  6 15:37:43 2013 127.0.0.1 - - [GET] "/feed1.ffm HTTP/1.1" 200 4175
Successfully opened the file.
Output #0, ffm, to 'http://localhost:8090/feed1.ffm':
  Metadata:
    creation_time   : now
    encoder         : Lavf55.12.100
    Stream #0:0, 0, 1/1000000: Audio: pcm_s16be, 48000 Hz, stereo, 1536 kb/s
    Stream #0:1, 0, 1/1000000: Video: h264, yuv420p, 640x480, 1/30, q=2-31,
-5 kb/s, 30 fps, 1000k tbn, 30 tbc
Stream mapping:
  Stream #1:0 -> #0:0 (copy)
  Stream #0:0 -> #0:1 (copy)
Press [q] to stop, [?] for help


More information about the ffmpeg-user mailing list