[FFmpeg-user] mix 2 mp4 audio only

Madovsky infos at madovsky.org
Mon Feb 4 05:41:49 CET 2013


>>> Madovsky <infos <at> madovsky.org> writes:
>>>
>>>> I'm trying to mix 2 streams without to decode
>>>> reencode using audio only
>>>>
>>>> ffmpeg -i stream1.mp4 -i stream2.mp4 -vn
>>>> -map 0:1 -map 1:1 -acodec copy out.mp4
>>>
>>> Please provide complete, uncut console output
>>> with every failing command line.
>>>
>>> Carl Eugen
>>
>> ok sorry I thought it was my mistake
>>
>> ====
>>
>> ffmpeg -debug -i stream1.mp4 -i stream2.mp4 -vn -map 0:1 -map 1:1 -acodec 
>> copy -y output.mp4
>> ffmpeg version N-49564-gd106679 Copyright (c) 2000-2013 the FFmpeg 
>> developers
>>  built on Feb  3 2013 16:11:33 with gcc 4.3.2 (GCC) 20081105 (Red Hat 
>> 4.3.2-7)
>>  configuration: --enable-static --enable-gpl --enable-nonfree --enable-libfaac 
>>  --enable-libx264 --enable-pthreads --enable-postproc --enable-libspeex --enable-librtmp 
>>  --enable-runtime-cpudetect --enable-libfreetype
>>  libavutil      52. 17.100 / 52. 17.100
>>  libavcodec     54. 91.100 / 54. 91.100
>>  libavformat    54. 61.104 / 54. 61.104
>>  libavdevice    54.  3.103 / 54.  3.103
>>  libavfilter     3. 35.101 /  3. 35.101
>>  libswscale      2.  2.100 /  2.  2.100
>>  libswresample   0. 17.102 /  0. 17.102
>>  libpostproc    52.  2.100 / 52.  2.100
>> matched as AVOption 'debug' with argument '-i'.
>> Reading option 'stream1.mp4' ... matched as output file.
>> Reading option '-i' ... matched as input file with argument 
>> 'stream2.mp4'.
>> Reading option '-vn' ... matched as option 'vn' (disable video) with 
>> argument '1'.
>> Reading option '-map' ... matched as option 'map' (set input stream 
>> mapping) with argument '0:1'.
>> Reading option '-map' ... matched as option 'map' (set input stream 
>> mapping) with argument '1:1'.
>> Reading option '-acodec' ... matched as option 'acodec' (force audio 
>> codec ('copy' to copy stream)) with argument 'copy'.
>> Reading option '-y' ... matched as option 'y' (overwrite output files) 
>> with argument '1'.
>> Reading option 'output.mp4' ... matched as output file.
>> Finished splitting the commandline.
>> Parsing a group of options: global .
>> Applying option y (overwrite output files) with argument 1.
>> Successfully parsed a group of options.
>> Parsing a group of options: input file stream2.mp4.
>> Successfully parsed a group of options.
>> Opening an input file: stream2.mp4.
>> [mov,mp4,m4a,3gp,3g2,mj2 @ 0x211ab00] Format mov,mp4,m4a,3gp,3g2,mj2 
>> probed with size=2048 and score=100
>> [mov,mp4,m4a,3gp,3g2,mj2 @ 0x211ab00] ISO: File Type Major Brand: isom
>> [mov,mp4,m4a,3gp,3g2,mj2 @ 0x211ab00] File position before 
>> avformat_find_stream_info() is 15758205
>> [mov,mp4,m4a,3gp,3g2,mj2 @ 0x211ab00] All info found
>> [mov,mp4,m4a,3gp,3g2,mj2 @ 0x211ab00] File position after 
>> avformat_find_stream_info() is 16912
>> Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'stream2.mp4':
>>  Metadata:
>>    major_brand     : isom
>>    minor_version   : 512
>>    compatible_brands: isomiso2avc1mp41
>>    title           : Twilight 4 Breaking Dawn
>>    encoder         : Lavf54.59.106
>>  Duration: 00:02:30.79, start: 0.000000, bitrate: 836 kb/s
>>    Stream #0:0(und), 1, 1/11988: Video: h264 (Constrained Baseline) (avc1 
>> / 0x31637661), yuv420p, 960x408 [SAR 1:1 DAR 40:17], 125/5994, 740 kb/s, 
>> 23.98 fps, 23.98 tbr, 11988 tbn, 47.95 tbc
>>    Metadata:
>>      handler_name    : VideoHandler
>>    Stream #0:1(und), 1, 1/44100: Audio: aac (mp4a / 0x6134706D), 44100 
>> Hz, stereo, fltp, 91 kb/s
>>    Metadata:
>>      handler_name    : SoundHandler
>> Successfully opened the file.
>> Parsing a group of options: output file stream1.mp4.
>> Successfully parsed a group of options.
>> Opening an output file: stream1.mp4.
>> Successfully opened the file.
>> Parsing a group of options: output file output.mp4.
>> Applying option vn (disable video) with argument 1.
>> Applying option map (set input stream mapping) with argument 0:1.
>> Applying option map (set input stream mapping) with argument 1:1.
>> Invalid input file index: 1.
>> Statistics: 154203 bytes read, 2 seeks
>>
>> ===
>>
>>
>> thanks
>>
>> Franck
>
> Arrgh, duno what's happened some test ate my movie test to 0 byte.
> that's why it didnt' work....
> ok now I try it with rtmp stream
>
> Thanks
>
> Frankc



Here is the log of rtmp test

=========

ffmpeg -i "rtmp://server/app/live live=1" -i "rtmp://rtmp://server/app/live2 
live=1" -vn -map 0:1 -map 1:1 -y -acodec copy output.flv
ffmpeg version N-49564-gd106679 Copyright (c) 2000-2013 the FFmpeg 
developers
  built on Feb  3 2013 16:11:33 with gcc 4.3.2 (GCC) 20081105 (Red Hat 
4.3.2-7)
  configuration: --enable-static --enable-gpl --enable-nonfree --enable-libfaac 
 --enable-libx264 --enable-pthreads --enable-postproc --enable-libspeex --enable-librtmp 
 --enable-runtime-cpudetect --enable-libfreetype
  libavutil      52. 17.100 / 52. 17.100
  libavcodec     54. 91.100 / 54. 91.100
  libavformat    54. 61.104 / 54. 61.104
  libavdevice    54.  3.103 / 54.  3.103
  libavfilter     3. 35.101 /  3. 35.101
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
rtmp server sent error
[flv @ 0x2db5a00] Estimating duration from bitrate, this may be inaccurate
Input #0, flv, from 'rtmp://server/app/live live=1':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: flv1, yuv420p, 320x240, 45.92 tbr, 1k tbn, 1k tbc
    Stream #0:1: Audio: speex, 16000 Hz, mono, s16
rtmp server sent error
[flv @ 0x2e4bd20] Estimating duration from bitrate, this may be inaccurate
Input #1, flv, from 'rtmp://server/app/live':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #1:0: Video: flv1, yuv420p, 320x240, 16.58 tbr, 1k tbn, 1k tbc
    Stream #1:1: Audio: speex, 16000 Hz, mono, s16
Output #0, flv, to 'output.flv':
  Metadata:
    encoder         : Lavf54.61.104
    Stream #0:0: Audio: speex ([11][0][0][0] / 0x000B), 16000 Hz, mono
    Stream #0:1: Audio: speex ([11][0][0][0] / 0x000B), 16000 Hz, mono
Stream mapping:
  Stream #0:1 -> #0:0 (copy)
  Stream #1:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
size=      47kB time=00:00:11.48 bitrate=  33.3kbits/s
video:0kB audio:34kB subtitle:0 global headers:0kB muxing overhead 
37.255240%
Received signal 2: terminating.

====

the listening result is like audio sliced and stretched
if I change -map 0:1 -map 1:1 to -map 0:1 -map 1:0 everthing is ok but I get 
only the first audio

Thanks

Franck




More information about the ffmpeg-user mailing list