FAQ  •  Register  •  Login

Manually add ffmpeg options?

<<

xalimar

Serviio newbie

Posts: 4

Joined: Sun Nov 07, 2010 8:48 pm

Post Sun Nov 07, 2010 8:56 pm

Manually add ffmpeg options?

I've gotten most of my media to transcode successfully, but I have some videos with multiple audio tracks and ffmpeg is defaulting to audio stream 2 then failing to transcode with an error resampling 6 channels @ 48000

Default ffmpeg command line without -map parameters:
  Code:
Stream mapping:
  Stream #0.0 -> #0.0
  Stream #0.2 -> #0.1

Resampling with input channels greater than 2 unsupported.
Can not resample 6 channels @ 48000 Hz to 2 channels @ 48000 Hz


I've found if I take the ffmpeg line from the debug log file and add -map 0:0 -map 0:1 it works fine.
  Code:
Stream mapping:
  Stream #0.0 -> #0.0
  Stream #0.1 -> #0.1


Is there any way for me to force those ffmpeg command line options in the windows version (or is there a better way to work around the resample 6 channels error?)
<<

zip

User avatar

Serviio developer / Site Admin

Posts: 17212

Joined: Sat Oct 24, 2009 12:24 pm

Location: London, UK

Post Sun Nov 07, 2010 9:00 pm

Re: Manually add ffmpeg options?

No. Did you try the options on the Transcoding tab of the console? (downsample, etc).
<<

xalimar

Serviio newbie

Posts: 4

Joined: Sun Nov 07, 2010 8:48 pm

Post Sun Nov 07, 2010 9:41 pm

Re: Manually add ffmpeg options?

Yeah, the above is with "Downmix to stereo" selected in the GUI. The below ffmpeg line is generated with relevant output
  Code:
C:\Program Files (x86)\Serviio\lib>ffmpeg.exe -i "C:\movie.mp4" -y -vcodec wmv2 -b 1800k -maxrate 1800k -bufsize 5097k -r 23.98 -g 15 -copyts -acodec wmav2 -ab 192k -ac 2 -sn -f asf C:\Windows\TEMP\Serviio\transcoding-temp-33-ASF.stf

    Stream #0.0(und): Video: h264, yuv420p, 1920x1080 [PAR 1:1 DAR 16:9], 6026 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 47.95 tbc
    Stream #0.1(eng): Audio: ac3, 48000 Hz, 6 channels, s16, 640 kb/s
    Stream #0.2(eng): Audio: aac, 48000 Hz, 5.1, s16, 319 kb/s
[wmv2 @ 02acffa0]impossible bitrate constraints, this will fail
Output #0, asf, to 'C:\Windows\TEMP\Serviio\transcoding-temp-33-ASF.stf':
  Metadata:
    WM/EncodingSettings: Lavf52.62.0
    Stream #0.0(und): Video: wmv2, yuv420p, 1920x1080 [PAR 1:1 DAR 16:9], q=2-31, 1800 kb/s, 1k tbn, 23.98 tbc
    Stream #0.1(eng): Audio: wmav2, 48000 Hz, 2 channels, s16, 192 kb/s
Stream mapping:
  Stream #0.0 -> #0.0
  Stream #0.2 -> #0.1
Press [q] to stop encoding
Compiler did not align stack variables. Libavcodec has been miscompiled
and may be very slow or crash. This is not a bug in libavcodec,
but in the compiler. You may try recompiling using gcc >= 4.2.
Do not report crashes to FFmpeg developers.
Resampling with input channels greater than 2 unsupported.
Can not resample 6 channels @ 48000 Hz to 2 channels @ 48000 Hz


If I switch Audio channels to "Keep original" I get the following command line and error:
  Code:
C:\Program Files (x86)\Serviio\lib>ffmpeg.exe -i "C:\movie.mp4" -y -vcodec wmv2 -b 1800k -maxrate 1800k -bufsize 5097k -r 23.98 -g 15 -copyts -acodec wmav2 -ab 192k -sn -f asf C:\Windows\TEMP\Serviio\transcoding-temp-33-ASF.stf

    Stream #0.0(und): Video: h264, yuv420p, 1920x1080 [PAR 1:1 DAR 16:9], 6026 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 47.95 tbc
    Stream #0.1(eng): Audio: ac3, 48000 Hz, 6 channels, s16, 640 kb/s
    Stream #0.2(eng): Audio: aac, 48000 Hz, 5.1, s16, 319 kb/s
[wmv2 @ 00fbffa0]impossible bitrate constraints, this will fail
Output #0, asf, to 'C:\Windows\TEMP\Serviio\transcoding-temp-33-ASF.stf':
    Stream #0.0(und): Video: wmv2, yuv420p, 1920x1080 [PAR 1:1 DAR 16:9], q=2-31, 1800 kb/s, 90k tbn, 23.98 tbc
    Stream #0.1(eng): Audio: wmav2, 48000 Hz, 5.1, s16, 192 kb/s
Stream mapping:
  Stream #0.0 -> #0.0
  Stream #0.2 -> #0.1
Error while opening encoder for output stream #0.1 - maybe incorrect parameters such as bit_rate, rate, width or height


The only difference in the command line is losing -ac 2. I'd be happy with getting either one to work if there is another parameter I can add to fix the bit_rate error instead of adding -map paramters.
<<

zip

User avatar

Serviio developer / Site Admin

Posts: 17212

Joined: Sat Oct 24, 2009 12:24 pm

Location: London, UK

Post Sun Nov 07, 2010 10:10 pm

Re: Manually add ffmpeg options?

could it be because there are 2 audio tracks (aac & ac3)?
<<

xalimar

Serviio newbie

Posts: 4

Joined: Sun Nov 07, 2010 8:48 pm

Post Sun Nov 07, 2010 11:29 pm

Re: Manually add ffmpeg options?

I think it is specific to the source having aac audio track. I have other mp4 files with multiple audio tracks that are all 2 channel and they appear to work.

I tried creating two new mp4's from my source movie.mp4 and copying the aac stream to one and the ac3 stream to the other.
I wound up with movie1.mp4 with these streams, and it errors out when trying to encode it with or without -ac 2.
  Code:
    Stream #0.0(und): Video: h264, yuv420p, 1920x1080 [PAR 1:1 DAR 16:9], 6026 kb/s, 23.98 fps, 23.98 tbr, 48k tbn, 47.95 tbc
    Stream #0.1(eng): Audio: aac, 48000 Hz, 5.1, s16, 319 kb/s
[wmv2 @ 032b02b0]impossible bitrate constraints, this will fail
Output #0, asf, to 'C:\Windows\TEMP\Serviio\transcoding-temp-33-ASF.stftemp-33-ASF.stf':
  Metadata:
    WM/EncodingSettings: Lavf52.62.0
    Stream #0.0(und): Video: wmv2, yuv420p, 1920x1080 [PAR 1:1 DAR 16:9], q=2-31, 1800 kb/s, 1k tbn, 23.98 tbc
    Stream #0.1(eng): Audio: wmav2, 48000 Hz, 2 channels, s16, 192 kb/s

ffmpeg without the -ac 2 option
  Code:
Error while opening encoder for output stream #0.1 - maybe incorrect parameters such as bit_rate, rate, width or height

ffmpeg with the -ac 2 option
  Code:
Resampling with input channels greater than 2 unsupported.
Can not resample 6 channels @ 48000 Hz to 2 channels @ 48000 Hz


movie2.mp4 that has ac3 audio track works fine. However it lists as 2 channel in the source stream even though I used -acodec copy to create it (and the transcode flew by at over 1000fps.) I suspect that since the transcode works with both audio tracks in the original source when I added the -map options that it would still work if this was correctly listed at 6 channel.
  Code:
    Stream #0.0(und): Video: h264, yuv420p, 1920x1080 [PAR 1:1 DAR 16:9], 6026 kb/s, 23.98 fps, 23.98 tbr, 48k tbn, 47.95 tbc
    Stream #0.1(eng): Audio: ac3, 48000 Hz, 2 channels, s16, 640 kb/s
[wmv2 @ 00feff10]impossible bitrate constraints, this will fail
Output #0, asf, to 'C:\Windows\TEMP\Serviio\transcoding-temp-33-ASF.stftemp-33-ASF.stf':
  Metadata:
    WM/EncodingSettings: Lavf52.62.0
    Stream #0.0(und): Video: wmv2, yuv420p, 1920x1080 [PAR 1:1 DAR 16:9], q=2-31, 1800 kb/s, 1k tbn, 23.98 tbc
    Stream #0.1(eng): Audio: wmav2, 48000 Hz, 2 channels, s16, 192 kb/s


My conclusion is that ffmpeg doesn't appear to work right with aac audio tracks, and it is defaulting to that stream even though it is stream #2. The reason my mp4 files have both ac3 and aac streams is because they are originally encoded to play native on ps3, which works with the aac stream but not the ac3 stream. ac3 stream works in other software. Obviously if I remove the ac3 stream and only have the aac stream the transcode will fail, so having the ac3 stream isn't harming it any.

My goal is to transcode to a format the xbox 360 can support, but I'm not sure how to accomplish this without somehow convincing ffmpeg to use the ac3 stream to transcode.
<<

xalimar

Serviio newbie

Posts: 4

Joined: Sun Nov 07, 2010 8:48 pm

Post Sun Nov 07, 2010 11:33 pm

Re: Manually add ffmpeg options?

I decided to try the same ffmpeg command lines on my ubuntu server.

If I leave off -ac 2 I still get the bit_rate error
  Code:
Error while opening codec for output stream #0.1 - maybe incorrect parameters such as bit_rate, rate, width or
height


But if I include -ac 2 the transcode works fine, it defaults to the ac3 audio stream (#0.1) instead of the aac (#0.2). So I might try running the linux version to see if it will work instead.

Return to Transcoding

Who is online

Users browsing this forum: No registered users and 13 guests

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.