Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add custom FFmpeg Audio options #1323

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Add custom FFmpeg Audio options #1323

wants to merge 2 commits into from

Conversation

Sami32
Copy link
Contributor

@Sami32 Sami32 commented Jun 26, 2017

As requested here: #1181 #1179

@Sami32 Sami32 changed the title Add audio custom FFmpeg options Add custom FFmpeg Audio options Jun 26, 2017
@onon765trb
Copy link
Contributor

GJ!!!

@Sami32
Copy link
Contributor Author

Sami32 commented Jun 30, 2017

@ler0y In your case adding these lines to your renderer configuration file will reduce transcoding to WAV having a sample rate < 48000:

TranscodeAudio = WAV
CustomAudioFFmpegOptions = -af aformat=sample_fmts=u8|s16:sample_rates=44100|48000

Fine tune it to your renderer support. Ex. 96000 if it's DTS is supported in WAV.

P.S. You can also use the -apre option, more powerful, but it also ask more modifications from the user side.

@Sami32 Sami32 force-pushed the audio_ffmpeg_custom branch 2 times, most recently from 9647fbd to 90adb4e Compare July 13, 2017 22:25
Copy link
Member

@SubJunk SubJunk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good start but needs a bit more work

# Overrides the FFmpeg Audio options in UMS for this renderer.
# An empty value means that the default UMS settings will be used.
# Default: ""
CustomAudioFFmpegOptions =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to rename this to CustomFFmpegAudioOptions to match our other conventions

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. I should admit that i saw it afterward and was too lazzy to change it.

@@ -2262,6 +2263,10 @@ public int getAutoPlayTmo() {
return getInt(AUTO_PLAY_TMO, 5000);
}

public String getCustomAudioFFmpegOptions() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

@@ -142,7 +144,7 @@ public synchronized ProcessWrapper launchTranscode(
configuration = (DeviceConfiguration)params.mediaRenderer;
final String filename = dlna.getFileName();
params.maxBufferSize = configuration.getMaxAudioBuffer();
params.waitbeforestart = 2000;
params.waitbeforestart = 1;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why change this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No waiting delay while playing music.
Tested by us without any issues since some months, also with my very old CPU.
If i remember correctly, we are talking about 100MB to be buffereized in 2s, it seem out of age, also for me.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok

@@ -200,30 +202,53 @@ public synchronized ProcessWrapper launchTranscode(
cmdList.add("" + params.timeend);
}

String customAudioFFmpegOptions = params.mediaRenderer.getCustomAudioFFmpegOptions();

// Add audio options (-af, -filter_complex, -ab, -ar, -ac, -c:a, -f, -apre, -fpre, -pre, etc.)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment could probably be put into DefaultRenderer.conf too

@@ -247,6 +272,44 @@ public synchronized ProcessWrapper launchTranscode(
return pw;
}

/**
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since these are already in FFmpegVideo which this extends, we shouldn't need to add them again unless they are different from those ones, in which case the @override flag should be present

Copy link
Contributor Author

@Sami32 Sami32 Jul 25, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Damned Github, i cannot see anything except /**

Please, feel free to push a commit using an @override flag, if the changes done are not correct, as i could learn from it for an eventual next time.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Sami32 I just checked and those parseOptions methods are identical to the ones in FFmpegVideo except for comment changes in the second one, so it would be better to remove those from this file and if you want, make the comment changes in FFmpegVideo. Otherwise it's just writing the same code twice which also means bugfixes need to get written twice, etc.

Copy link
Contributor Author

@Sami32 Sami32 Jul 25, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that doesn't use the same code twice will be good.

But, just to be clear, when i do the changes asked and that errors arise, i just stop brutally to be interested...
So, or you push a commit, or this PR will wait until my mood become better...

Copy link
Member

@SubJunk SubJunk Jul 26, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Sami32 "when i do the changes asked" you didn't do the changes asked. I said to add @override if the methods are different otherwise we shouldn't need to add them, and they are not different.

Up to you whether you implement the changes or not :)

@Sami32 Sami32 force-pushed the audio_ffmpeg_custom branch 2 times, most recently from 747e978 to bd72934 Compare July 25, 2017 18:04
@@ -247,6 +272,44 @@ public synchronized ProcessWrapper launchTranscode(
return pw;
}

/**
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Sami32 I just checked and those parseOptions methods are identical to the ones in FFmpegVideo except for comment changes in the second one, so it would be better to remove those from this file and if you want, make the comment changes in FFmpegVideo. Otherwise it's just writing the same code twice which also means bugfixes need to get written twice, etc.

@Sami32 Sami32 force-pushed the audio_ffmpeg_custom branch 2 times, most recently from 22bee6e to c8d5fb9 Compare July 27, 2017 01:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

None yet

4 participants