Skip to content

Commit

Permalink
CustomMencoderOptions defined on renderer level added.
Browse files Browse the repository at this point in the history
Added info to Renderer.conf for hidden params.
  • Loading branch information
ExSport committed Jan 12, 2012
1 parent e986194 commit e1b0139
Show file tree
Hide file tree
Showing 4 changed files with 188 additions and 101 deletions.
46 changes: 45 additions & 1 deletion src/main/external-resources/renderers/PS3.conf
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,17 @@ SeekByTime = true
# see the files. Important for Sony Bravia's TVs.
DLNALocalizationRequired = false

# CBRVideoBitrate is useful for renderers without SeekByTime support. It does time2byte conversion to support FF/RW.
# Only possibility how to predict where we are when seeking is using CBR bitrate instead of VBR used by default
# Making CBR stream by MEnocder is 3 times slower than using VBR so count with it if you have poor computer!
# Speed can be hopefully optimized little bit in the future:
# http://www.ps3mediaserver.org/forum/viewtopic.php?f=14&t=8883&p=53706&hilit=ditlew#p53700
# http://www.ps3mediaserver.org/forum/viewtopic.php?f=11&t=11284&p=62765&hilit=1835#p62765
CBRVideoBitrate=15000

# ByteToTimeseekRewindSeconds is used for finetuning so default is 0
ByteToTimeseekRewindSeconds=0

#-----------------------------------------------------------------------------
# MEDIAINFO
#
Expand Down Expand Up @@ -158,6 +169,9 @@ MuxLPCMToMpeg = true

# MaxVideoBitrateMbps: The maximum bit rate supported by the media renderer.
# Setting to "0" means unlimited.
# If computer is low on resources it is better to avoid using bandwidth limit which is much CPU demanding
# It is better to lower quality settings by defining "CustomMencoderQualitySettings".
# By lowering quality also bitrate is decreased but it is not so CPU aggresive so it is preferred to use it this way
MaxVideoBitrateMbps = 0

# MaxVideoWidth: Maximum width supported by the media renderer. Setting to "0"
Expand All @@ -181,7 +195,7 @@ TranscodeAudioTo441kHz = false
# TranscodeFastStart: Set to "true" if the renderer has a short timeout delay
# and needs to receive transcoded video with minimal delay. If set to "false",
# PMS will take some time to buffer some of the transcoded video.
TranscodeFastStart = false
TranscodeFastStart = true

# TranscodedVideoFileSize: The amount of transcoded data is unknown at the
# time of transcoding. Still, some renderers expect a size for the video file
Expand Down Expand Up @@ -223,13 +237,43 @@ ChunkedTransfer = false
# settings will be used.
CustomMencoderQualitySettings =

# CustomMencoderOptions: Overrides the MEncoder custom options in PMS for
# this renderer. Default is empty, which means the PMS
# settings will be used.
CustomMencoderOptions =

# SubtitleHttpHeader: Some devices recognize a custom HTTP header for
# retrieving the contents of a subtitles file. Set this option to the name of
# that custom header and PMS will send the URL for the subtitles file in that
# header (e.g. Samsung devices recognize the "CaptionInfo.sec" header).
# Default value is "", which means PMS will not send such header information.
SubtitleHttpHeader =

#-----------------------------------------------------------------------------
# Another useful hidden params and their default values if not defined:
#

# Display audio tag in TRANSCODE folder if defined in container (useful to find out correct audio track like commentary etc.)
# ShowAudioMetadata = true

# Display subtitle tag in TRANSCODE folder if defined in container (showing subtitles info like forced, full, documentary etc.)
# ShowSubMetadata = true

# Some renderers can't show length of DVD titles so it will add it directly to title name to be shown
# ShowDVDTitleDuration = false

# Specified extension will be added to every file shared by PMS
# UseSameExtension = null

# ????????????????????????????
# DLNAProfileChanges = null

# ????????????????????????????
# DLNAOrgPN = true

# ????????????????????????????
# MediaParserV2_ThumbnailGeneration = false

#-----------------------------------------------------------------------------
# IMAGES
#
Expand Down
224 changes: 126 additions & 98 deletions src/main/external-resources/renderers/Panasonic.conf
Original file line number Diff line number Diff line change
@@ -1,98 +1,126 @@
RendererName=Panasonic
RendererIcon=kuro.png
UserAgentSearch=Panasonic MIL DLNA
Video=true
Audio=true
Image=true
SeekByTime=false
CBRVideoBitrate=15000
ByteToTimeseekRewindSeconds=0
DLNALocalizationRequired=true

TranscodeVideo=MPEGAC3
TranscodeAudio=WAV
DefaultVBVBufSize=false
MuxH264ToMpegTS=true
MuxDTSToMpeg=false
WrapDTSIntoPCM=false
MuxLPCMToMpeg=true

MaxVideoBitrateMbps=90
MaxVideoWidth=1920
MaxVideoHeight=1080
H264Level41Limited=true
TranscodeAudioTo441kHz=false
TranscodeFastStart=true

#TranscodedVideoFileSize=-1
TranscodedVideoFileSize=0
#TranscodedVideoFileSize=100000000000
AutoExifRotate=false
#UseSameExtension=mpg
#MimeTypesChanges=audio/wav=audio/L16|video/mp4=video/mpeg|video/mkv=video/mpeg
TranscodeExtensions=
StreamExtensions=

SoftSubSupport=false
CustomMencoderQualitySettings=keyint=5:vqscale=1:vqmin=3:vqmax=5
# XXX: note this option is *not* supported by official builds
# pullup pro deinterlacing
CustomMencoderOptions=-vf softskip,expand=::::1:16\/9:4

MediaInfo=true

Supported = f:mpegps|mpegts v:mpeg1|mpeg2|mp4|h264 a:ac3|lpcm|aac|mpa m:video/mpeg
Supported = f:avi|divx v:mp4|divx|mjpeg a:mp3|lpcm|mpa|ac3 m:video/divx qpel:no gmc:0
Supported = f:mp4 v:mp4|h264 a:ac3|aac m:video/mp4
Supported = f:wmv v:wmv|vc1 a:wma n:2 m:video/x-ms-wmv

#Supported = f:lpcm m:audio/L16
Supported = f:wav a:dts|lpcm n:6 s:48000 m:audio/wav
Supported = f:wav n:2 s:48000 m:audio/wav
Supported = f:mp3 n:2 m:audio/mpeg

Supported = f:aac n:2 a:(?!alac).+ m:audio/x-m4a
Supported = f:wma n:2 m:audio/x-ms-wma
Supported = f:atrac n:2 m:audio/x-oma

Supported = f:jpg m:image/jpeg
Supported = f:png m:image/png
Supported = f:gif m:image/gif
Supported = f:tiff m:image/tiff

# ===========================================================================

## WHAT TV SUPPORTS? (retrieved from manual)
#--------------------------------------------
# container: avchd, divx, mpeg2,...
# extensions: divx,avi, mpg, mpeg,wmv, ...
# video codec: DIV3, DIV4, DIVX, DX50, DIV6, MPEG-2(PS/TS)
# audio codec: mp3, mpeg, ac3
# GMC not supported
# subtitles: microdvd, subrip (subtitles name must be same)...priority when same name: SRT, SUB, TXT
# pictures: jpg, jpeg 4:4:4, 4:2:2, 4:2:0

# VIERA Image Viewer: Ano (AVCHD/SD-VIDEO/DivXHD/JPEG/MP3/AAC playback)

## What was found about renderer in debug.log
#---------------------------------------------

# Received on socket: User-Agent: Panasonic MIL DLNA CP UPnP/1.0
# Received on socket: X-PANASONIC-DMP-Profile: MPEG_PS_PAL JPEG_SM PV_DIVX_DIV3 PV_DIVX_DIV4 PV_DIVX_DIVX PV_DIVX_DX50 PV_DRM_DIVX_DIV3 PV_DRM_DIVX_DIV4 PV_DRM_DIVX_DIVX PV_DRM_DIVX_DX50
# Received on socket: X-PANASONIC-Registration: VklFUkEAAAAAAAAAAAAAAAAAAAAAAAAAAAA=


#I tested 4 combinations:
#- SeekByTime = true
#- SeekByTime = false
#- TranscodedVideoFileSize=100000000000
#- TranscodedVideoFileSize=0
#Results:
#When SeekByTime=false and TranscodedVideoFileSize=0, transcoded file has no info about actual time(total time is visible) and seeking is somehow/sometimes possible.
#When 99GB is set, I can see actual time but when seeking, time is visible but immediately freeze and TV will show corrupted data or movie starts from begining or from point where I started to seek.
#When SeekByTime=true, PMS generates exceptions and movie starts from beginning always when I use seeking. It seems that TV maybe doesn't support seeking by time, but why PMS generates exceptions?
#When I tried TranscodedVideoFileSize=-1, seeking will start movie from beginning every time.
#When TranscodedVideoFileSize is defined to something about 1GB, I can see actual time but seeking is working only for some minutes/seconds to forward. It means I can seek forward for few seconds but not more because it seems PMS will send end of file and streaming will freeze/file cannot be played.
#When I set 10GB, behavior is same as for 99GB(mayble some TV limit about maximum size of file???)
#Shagrath, please it is somehow possible to make it work? With help of conf file and attached debug.logs so maybe some tweaks in PMS itself plus tweaking .conf file will make it work(seeking+actual time visible so we will know where we are now when playing and where we are when forwarding so we can stop or continue in rewinding)?

RendererName=Panasonic
RendererIcon=kuro.png
UserAgentSearch=Panasonic MIL DLNA
Video=true
Audio=true
Image=true
SeekByTime=false
DLNALocalizationRequired=true

# CBRVideoBitrate is useful for renderers without SeekByTime support. It does time2byte conversion to support FF/RW.
# Only possibility how to predict where we are when seeking is using CBR bitrate instead of VBR used by default
# Making CBR stream by MEnocder is 3 times slower than using VBR so count with it if you have poor computer!
# Speed can be hopefully optimized little bit in the future:
# http://www.ps3mediaserver.org/forum/viewtopic.php?f=14&t=8883&p=53706&hilit=ditlew#p53700
# http://www.ps3mediaserver.org/forum/viewtopic.php?f=11&t=11284&p=62765&hilit=1835#p62765
# ByteToTimeseekRewindSeconds is used for finetuning so default is 0
CBRVideoBitrate=15000
ByteToTimeseekRewindSeconds=0

TranscodeVideo=MPEGAC3
TranscodeAudio=WAV
DefaultVBVBufSize=false
MuxH264ToMpegTS=true
MuxDTSToMpeg=false
WrapDTSIntoPCM=false
MuxLPCMToMpeg=true

MaxVideoWidth=1920
MaxVideoHeight=1080
H264Level41Limited=true
TranscodeAudioTo441kHz=false
TranscodeFastStart=true
TranscodedVideoFileSize=0

# If computer is low on resources it is better to avoid using bandwidth limit which is much CPU demanding
# It is better to lower quality settings by defining "CustomMencoderQualitySettings".
# By lowering quality also bitrate is decreased but it is not so CPU aggresive so it is preferred to use it this way
MaxVideoBitrateMbps=90
CustomMencoderQualitySettings=keyint=5:vqscale=1:vqmin=3:vqmax=5
CustomMencoderOptions=-vf softskip,expand=::::1:16\/9:4

AutoExifRotate=true
MimeTypesChanges=audio/wav=audio/L16|video/mp4=video/mpeg|video/mkv=video/mpeg
TranscodeExtensions=
StreamExtensions=

#-----------------------------------------------------------------------------
# Another useful hidden params and their default values if not defined:

# Display audio tag in TRANSCODE folder if defined in container (useful to find out correct audio track like commentary etc.)
# ShowAudioMetadata = true

# Display subtitle tag in TRANSCODE folder if defined in container (showing subtitles info like forced, full, documentary etc.)
# ShowSubMetadata = true

# Some renderers can't show length of DVD titles so it will add it directly to title name to be shown
# ShowDVDTitleDuration = false

# Specified extension will be added to every file shared by PMS
# UseSameExtension = null

# ????????????????????????????
# DLNAProfileChanges = null

# ????????????????????????????
# DLNAOrgPN = true

# ????????????????????????????
# MediaParserV2_ThumbnailGeneration = false
#-----------------------------------------------------------------------------

MediaInfo=true

Supported = f:mpegps|mpegts v:mpeg1|mpeg2|mp4|h264 a:ac3|lpcm|aac|mpa m:video/mpeg
Supported = f:avi|divx v:mp4|divx|mjpeg a:mp3|lpcm|mpa|ac3 m:video/x-divx qpel:yes gmc:0
Supported = f:mp4 v:mp4|h264 a:ac3|aac m:video/mp4
Supported = f:wmv v:wmv|vc1 a:wma n:2 m:video/x-ms-wmv

#Supported = f:lpcm m:audio/L16
Supported = f:wav a:dts|lpcm n:6 s:48000 m:audio/wav
Supported = f:wav n:2 s:48000 m:audio/wav
Supported = f:mp3 n:2 m:audio/mpeg

Supported = f:aac n:2 a:(?!alac).+ m:audio/x-m4a
Supported = f:wma n:2 m:audio/x-ms-wma
Supported = f:atrac n:2 m:audio/x-oma

Supported = f:jpg m:image/jpeg
Supported = f:png m:image/png
Supported = f:gif m:image/gif
Supported = f:tiff m:image/tiff

# ===========================================================================

## WHAT TV SUPPORTS? (retrieved from manual)
#--------------------------------------------
# container: avchd, divx, mpeg2,...
# extensions: divx,avi, mpg, mpeg,wmv, ...
# video codec: DIV3, DIV4, DIVX, DX50, DIV6, MPEG-2(PS/TS)
# audio codec: mp3, mpeg, ac3
# GMC not supported
# subtitles: microdvd, subrip (subtitles name must be same)...priority order when same name: SRT, SUB, TXT
# pictures: jpg, jpeg 4:4:4, 4:2:2, 4:2:0

# VIERA Image Viewer: Yes (AVCHD/SD-VIDEO/DivXHD/JPEG/MP3/AAC playback)

## What was found about renderer in debug.log
#---------------------------------------------

# Received on socket: User-Agent: Panasonic MIL DLNA CP UPnP/1.0
# Received on socket: X-PANASONIC-DMP-Profile: MPEG_PS_PAL JPEG_SM PV_DIVX_DIV3 PV_DIVX_DIV4 PV_DIVX_DIVX PV_DIVX_DX50 PV_DRM_DIVX_DIV3 PV_DRM_DIVX_DIV4 PV_DRM_DIVX_DIVX PV_DRM_DIVX_DX50
# Received on socket: X-PANASONIC-Registration: VklFUkEAAAAAAAAAAAAAAAAAAAAAAAAAAAA=


# I tested 4 combinations:
# - SeekByTime = true
# - SeekByTime = false
# - TranscodedVideoFileSize=100000000000
# - TranscodedVideoFileSize=0
# Results (with version before 1.50, never tested it again with newer versions):
# When SeekByTime=false and TranscodedVideoFileSize=0, transcoded file has no info about actual time(total time is visible) and seeking is somehow/sometimes possible.
# When 99GB is set, I can see actual time but when seeking, time is visible but immediately freeze and TV will show corrupted data or movie starts from begining or from point where I started to seek.
# When SeekByTime=true, PMS generates exceptions and movie starts from beginning always when I use seeking. It seems that TV maybe doesn't support seeking by time, but why PMS generates exceptions?
# When I tried TranscodedVideoFileSize=-1, seeking will start movie from beginning every time.
# When TranscodedVideoFileSize is defined to something about 1GB, I can see actual time but seeking is working only for some minutes/seconds to forward. It means I can seek forward for few seconds but not more because it seems PMS will send end of file and streaming will freeze/file cannot be played.
# When I set 10GB, behavior is same as for 99GB(mayble some TV limit about maximum size of file???)
11 changes: 11 additions & 0 deletions src/main/java/net/pms/configuration/RendererConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ public boolean isFDSSDP() {
private static final String MEDIAPARSERV2_THUMB = "MediaParserV2_ThumbnailGeneration";
private static final String SUPPORTED = "Supported";
private static final String CUSTOM_MENCODER_QUALITYSETTINGS = "CustomMencoderQualitySettings";
private static final String CUSTOM_MENCODER_OPTIONS = "CustomMencoderOptions";
private static final String SHOW_AUDIO_METADATA = "ShowAudioMetadata";
private static final String SHOW_SUB_METADATA = "ShowSubMetadata";
private static final String DLNA_TREE_HACK = "CreateDLNATreeFaster";
Expand Down Expand Up @@ -669,6 +670,16 @@ public String getCustomMencoderQualitySettings() {
return getString(CUSTOM_MENCODER_QUALITYSETTINGS, null);
}

/**
* Returns the override settings for MEncoder custom options in PMS as
* defined in the renderer configuration. Default is empty.
*
* @return The MEncoder custom options.
*/
public String getCustomMencoderOptions() {
return getString(CUSTOM_MENCODER_OPTIONS, null);
}

/**
* Returns the maximum video width supported by the renderer as defined in
* the renderer configuration. The default value 0 means unlimited.
Expand Down
8 changes: 6 additions & 2 deletions src/main/java/net/pms/encoders/MEncoderVideo.java
Original file line number Diff line number Diff line change
Expand Up @@ -1254,7 +1254,11 @@ public ProcessWrapper launchTranscode(
}

String add = "";
if (configuration.getMencoderDecode() == null || configuration.getMencoderDecode().indexOf("-lavdopts") == -1) {
if (params.mediaRenderer.getCustomMencoderOptions() != null) {
if (params.mediaRenderer.getCustomMencoderOptions().indexOf("-lavdopts") == -1) {
add = " -lavdopts debug=0";
}
} else if (configuration.getMencoderDecode() == null || configuration.getMencoderDecode().indexOf("-lavdopts") == -1) {
add = " -lavdopts debug=0";
}

Expand All @@ -1268,7 +1272,7 @@ public ProcessWrapper launchTranscode(
}
logger.trace("channels=" + channels);

StringTokenizer st = new StringTokenizer(alternativeCodec + "-channels " + channels + " " + configuration.getMencoderDecode() + add, " ");
StringTokenizer st = new StringTokenizer(alternativeCodec + "-channels " + channels + " " + ((params.mediaRenderer.getCustomMencoderOptions()!=null && !(params.mediaRenderer.getCustomMencoderOptions().indexOf("expand=") != -1 && dvd))?(params.mediaRenderer.getCustomMencoderOptions()):configuration.getMencoderDecode()) + add, " ");
overriddenMainArgs = new String[st.countTokens()];
int i = 0;
boolean processToken = false;
Expand Down

0 comments on commit e1b0139

Please sign in to comment.