-   Linux - Software (
-   -   ffmpeg now fails to see audio stream (

jr_bob_dobbs 05-07-2018 07:13 PM

ffmpeg now fails to see audio stream
So when I re-code a DVD, I use mencoder to handle the video part and ffmpeg to handle the audio (including mixing 5:1 down to stereo). The reason for the latter is in all the years I've tried, I've never figured out how to get mencoder to extract mix and write just audio.

Got a new DVD. vobcopied it. Identified which VOBs are the one I want. Ran a script to recode just the video part. Nothing new there. Do this all the time. Familiar. No problems. Did not expect any.

Problem: I ran my usual command options with ffmpeg to get audio and ... ffmpeg claims there is no audio stream. That's a new one. And yet somehow ffplay plays the files fine, with sound. Contradiction.

The relevant section of my script (which has worked for ages):

cat \
/hsc/vobcopy_temp/$MOVHERE/VIDEO_TS/VTS_07_[1-7].VOB | \
ffmpeg \
 -i - -f wav -vn \
 -map i:0x80 \
 -af pan=stereo:FL=FC+0.30*FL+0.30*BL:FR=FC+0.30*FR+0.30*BR \
 -acodec pcm_s16le \

The above is code that has worked for many movies. Seemes the English/first audio track is always 0x:80. I do not see why it would fail now.

Ran mplayer just to see what streams it saw. Hmm, 0x80, 0x81, 0x82, 0x83, yup: four audio streams, named (well, numbered) as usual.

Consultation of the manual reveals that maybe the syntax for ffmpeg's "-map" has changed. Right, so I say "-map 0:0" or even "-map 0:a:0" now? OK, whatever. I make the change. Nope. Still fails. Sigh.

Right: two questions. One: how to accomplish the following ...

me: Hey ffmpeg, how ya doing?
ff: Great! How are you?
me: Excellent. hey, I have an input stream for you coming in on stdin.
ff: I can do that!
me: Great. Hey, it's 5:1, you can handle that, right?
ff: Yessir!
me: And it's the first of four known streams, as revealed by mplayer
ff: I don't like mplayer.
me: Well, ffmpeg, you're smarter than mplayer, right? So you can do this, right?
ff: Yes I can!
me: Great, find that audio, mix it to stereo, and send it to a wav file, mmmkay?
ff: Sure thing!
... via command line options to an ffmpeg run.

Failing that, question two:

If mencoder can do this, how? I've never been able to figure this out over several years

Thank you.

AwesomeMachine 05-07-2018 08:23 PM

I don't know if mencoder will extract audio directly from a DVD. But it will from a video file, such as avi or mpg. I don'[t know the exact command line off the top of my head. But try ripping the mpg off the DVD and then get the audio off that.

Drakeo 05-07-2018 08:37 PM

Dobbs what has changed ? Put a pipe in it and see the DIFF

jr_bob_dobbs 01-07-2019 08:35 PM

So after giving up (six months ago) I returned to the problem.

First step: although ffmpeg programs all fail to recognize nor play the audio, ffplay at least indicates that there is audio, in the form of AAC, but zero channels. There is no such thing as audio with zero chaannels, so that' s some indication of the problem. Maybe it is the interleaving of the audio with the video that is funky. So we break the processing of the audio into two tasks.

First task, seperate the audio out, as-is. The raw audio codec data, all by itself in a different container, may work with fflay/ffmpeg. So how to get that? Various search engines, docs, and Trial & error resulted in a way to get that audio out using mencoder:

cat /hsc/vobcopy_temp/$MOVHERE/VIDEO_TS/VTS_07_[1-7].VOB | \
mencoder \
 - \
 -ni \
 -o output.aac \
 -ni \
 -of rawaudio \
 -ovc frameno \
 -oac copy

I took ffplay's word that the audio was AAC and apparently it was, because that command worked. Putting -ni in twice was not a mistake. That was the result of an error message saying I should use -ni. Did so. Got the message again. Put a second -ni in. Then it worked. Go figure.

Turns out that, once the audio was all by itself, suddenly ffplay, and thus ffmpeg, would read it. Great.

The audio was in six channel form. No problem, many DVDs use this and that is familiar ground:

ffmpeg \
 -i output.aac -f wav -vn \
 -af pan=stereo:FL=FC+0.30*FL+0.30*BL:FR=FC+0.30*FR+0.30*BR \
 -acodec pcm_s16le \

In the above, we mix 5:1 down to stereo, dropping the subsonic track and mixing the center track louder than the others: this makes speech a bit more discernable.

That worked. From then on, usual conversion to a compressed format and remuxing with the video.

All times are GMT -5. The time now is 02:12 PM.