saloromer / ffmbc

Automatically exported from code.google.com/p/ffmbc
0 stars 0 forks source link

-map_audio_channel and -map conflict #38

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
1)
* Make an ffmbc CLI with multiple input files and multiple output files (e.g 
atomised input to separate audio and video pipe output)
* Use -map to direct ffmbc to use the correct input for video output
* Use -map_audio_channel to describe what input audio maps to what output 
channels
* e.g  ffmbc0.6rc3 -r 25 -i "x.MP4" -r 25 -i "y.MP4" -map 0:0 -an -r 25 -vcodec 
rawvideo -pix_fmt uyvy422 -y /tmp/z.yuv -vn -f s16le -acodec pcm_s16le -ac 2 
-ar 48000 -y /tmp/z.wav -newaudio -map_audio_channel 1:1:0:1:0:0 
-map_audio_channel 1:1:1:1:0:1

Result:
* ffmbc will complain that every output stream must have a map statement:
"Number of stream maps must match number of output streams"

2)
* As above but include a -map for the audio
* e.g ffmbc0.6rc3 -r 25 -f s16le -ac 2 -ar 48000 -i "/dev/zero" -r 25 -i 
"x.MP4" -r 25 -i "y.MP4" -shortest -map 1:0 -an -r 25 -vcodec rawvideo -pix_fmt 
uyvy422 -y /tmp/z.yuv -map 0:0 -vn -f s16le -acodec pcm_s16le -ac 2 -ar 48000 
-y /tmp/z.wav -newaudio -map_audio_channel 1:1:0:1:0:0  -map_audio_channel 
2:1:0:1:0:1

Result:
* ffmbc will ignore map_audio_channel statements and use stream specified by 
map statement, in this case resulting in a raw WAV file consisting of all 0s

Using:
FFmpeg version FFmbc-0.6-rc3, Copyright (c) 2000-2011 the FFmpeg developers
  built on Mar 14 2011 11:30:24 with gcc 4.4.3
  configuration: --cpu=amd64 --enable-static --extra-cflags='--static -I$PREFIX/include' --extra-libs='-static -L$PREFIX/lib' --prefix=/usr/local --enable-ffplay --enable-ffprobe --enable-ffserver --enable-gpl --enable-nonfree --enable-pthreads --enable-x11grab --enable-libxvid --enable-libvorbis --enable-libopenjpeg --enable-libspeex --enable-libtheora --enable-libfaac --enable-libgsm --enable-libdirac --enable-libmp3lame --enable-libx264 --enable-libschroedinger --enable-libvpx
  libavutil    50. 38. 0 / 50. 38. 0
  libavcodec   52.112. 1 / 52.112. 1
  libavformat  52. 99. 0 / 52. 99. 0
  libavdevice  52.  2. 3 / 52.  2. 3
  libavfilter   1. 76. 0 /  1. 76. 0
  libswscale    0. 12. 0 /  0. 12. 0

Perhaps it's as simple as making map_audio_channel directives count towards the 
test for whether all outputs have a map statement?

Original issue reported on code.google.com by gronksp...@gmail.com on 13 Apr 2011 at 2:01

GoogleCodeExporter commented 8 years ago
-vn and -an disable video and audio respectively, the first command line is 
bogus.

-map_audio_channel overrides -map obviously

Original comment by baptiste...@gmail.com on 15 Apr 2011 at 8:17

GoogleCodeExporter commented 8 years ago
Apologies, -vn and -an are strictly unnecessary to replicate the problem but 
they make explicit what the output to the respective pipes is. The first is 
purely video, hence the -an, the second is purely audio, hence the -vn and the 
-newaudio post the filename to reinsert an audio stream.

And unfortunately -map_audio_channel does not override -map, hence the audio 
file in the second example being full of 0s without correctly mapped essence as 
specified by the map_audio_channel directives.

Though the -an and -vn are unnecessary to replicate the problem, removing them 
will leave identical and still broken behaviour. I would ask you to please 
re-examine the command lines and try again to replicate the erroneous 
behaviour, it definitely exists and definitely breaks valid use cases

Original comment by gronksp...@gmail.com on 15 Apr 2011 at 8:51

GoogleCodeExporter commented 8 years ago
To perhaps further clarify;
* The key problem is that you cannot have one map directive without having a 
map directive for every output stream, and map_audio_channel does not count 
towards this
* This is compounded by the fact that if you do specify a 'placebo' map 
statement for an output stream you wish to supply more detailed 
map_audio_channel directives for, the map overrides the map_audio_channel 
directives, rendering them useless

Original comment by gronksp...@gmail.com on 15 Apr 2011 at 9:05

GoogleCodeExporter commented 8 years ago
Err yes, -map overrides -map_audio_channel

It's one -map for each output stream like the error message say.

What you describe is expected behaviour. I'm not sure what you are asking here.
Do you want the behaviour changed ? If so, that's not planned currently.

Original comment by baptiste...@gmail.com on 16 Apr 2011 at 12:06

GoogleCodeExporter commented 8 years ago
First, thanks for checking on the issue and reading my comments.

If this is expected behaviour then perhaps I'm trying to do something 
impossible. I can understand why there has to be a map per output but my 
limited understanding of ffmbc is such that I was viewing map_audio_channel as 
a refinement of map's behaviour, with additional granularity.

Hence, in the case stated above, where I take N input streams and map them to 2 
output streams, but where the 2nd has M audio channels, I was hoping to use 1 
map statement and M map_audio_channel statements and to have the fact that 
there was at least one map_audio_channel to the 2nd stream count as a map 
statement for validation purposes:

input              output

a1       ->          b (video stream, has -map)
a2
         ->          a2 (audio stream, 4 channels, has 4x -map_audio_channel and no -map)
b                    c2
                     d1
c1                   d2
c2

d1
d2

Is this breaking the model? If so, how might I go about achieving this sort of 
mapping?

Thanks again for spending the time replying

Original comment by gronksp...@gmail.com on 16 Apr 2011 at 7:17

GoogleCodeExporter commented 8 years ago
Hi Baptiste,

Lets say I want to output an pal-imx30, and my input file is a .ts with two 
video streams and two audio streams each with two audio channels.

Perhaps I want the pal-imx30 file to contain the second video stream and all 
four audio channels from the input.

I will need to -map the video and -map_audio_channel the audio. But the moment 
I -map the video I have to -map the audio to comply with the one-map-per-output 
requirement. Having a -map for the audio means I cannot make a four channel 
audio stream, and even if I was happy with a two channel output stream -map 
overrides -map_audio_channels.

I think what Paul was requesting is for -map_audio_channel into a -newaudio 
needs to count as though it were a -map.

Does that make any sense?

Original comment by mark.him...@gmail.com on 18 Apr 2011 at 10:43

GoogleCodeExporter commented 8 years ago
Hey Mark,

Yes I understand the case. It should work if the first video stream is the 
wanted one though, since in this case -map is not needed.

Original comment by baptiste...@gmail.com on 23 Apr 2011 at 9:41

GoogleCodeExporter commented 8 years ago
It should now work in 0.7-rc1

Original comment by baptiste...@gmail.com on 22 Sep 2011 at 5:08