1) BRAVIA doesn't support AVC-video with height<288. The following patch forces transcoding instead of transmuxing for video with height<288. It should be used with the option: mencoder_decode = -vf expand=:288:::1:16\/9 in PMS.conf to ensure that the video is resized if the height is less than 288.
- Code: Select all
--- net/pms/dlna/DLNAResource.java
+++ net/pms/dlna/DLNAResource.java
@@ -709,7 +709,7 @@
// do we have some mpegts to offer ?
boolean mpegTsMux = TSMuxerVideo.ID.equals(player.id()) || VideoLanVideoStreaming.ID.equals(player.id());
if (!mpegTsMux) { // maybe, like the ps3, mencoder can launch tsmuxer if this a compatible H264 video
- mpegTsMux = MEncoderVideo.ID.equals(player.id()) && ((media_subtitle == null && media != null && media.dvdtrack == 0 && media.muxable
+ mpegTsMux = MEncoderVideo.ID.equals(player.id()) && ((media_subtitle == null && media != null && media.dvdtrack == 0 && !(mediaRenderer.isBRAVIA() && media.height < 288)
&& PMS.getConfiguration().isMencoderMuxWhenCompatible() && mediaRenderer.isMuxH264MpegTS())
|| mediaRenderer.isTranscodeToMPEGTSAC3());
}
--- net/pms/encoders/MEncoderVideo.java
+++ net/pms/encoders/MEncoderVideo.java
@@ -1011,7 +1011,7 @@
dvd = true;
ovccopy = false;
- if (params.sid == null && !dvd && !avisynth() && media != null && (media.isVideoPS3Compatible(newInput) || !params.mediaRenderer.isH264Level41Limited()) && configuration.isMencoderMuxWhenCompatible() && params.mediaRenderer.isMuxH264MpegTS()) {
+ if (!(params.mediaRenderer.isBRAVIA()&&media.height<288) && params.sid == null && !dvd && !avisynth() && media != null && (media.isVideoPS3Compatible(newInput) || !params.mediaRenderer.isH264Level41Limited()) && configuration.isMencoderMuxWhenCompatible() && params.mediaRenderer.isMuxH264MpegTS()) {
String sArgs [] = getSpecificCodecOptions(PMS.getConfiguration().getCodecSpecificConfig(), media, params, fileName, subString, PMS.getConfiguration().isMencoderIntelligentSync(), false);
boolean nomux = false;
for(String s:sArgs) {
2) AVC files that can be transmuxed is registered as MPEG2 files due to media.muxable not being initialized (It's initialized by DLNAResource.isVideoPS3Compatible), removing media.muxable fixes this error. A better solution would be to set media.muxable in mediainfo depending on the renderers capability:
- Code: Select all
--- net/pms/dlna/DLNAResource.java
+++ net/pms/dlna/DLNAResource.java
@@ -709,12 +709,12 @@
// do we have some mpegts to offer ?
boolean mpegTsMux = TSMuxerVideo.ID.equals(player.id()) || VideoLanVideoStreaming.ID.equals(player.id());
if (!mpegTsMux) { // maybe, like the ps3, mencoder can launch tsmuxer if this a compatible H264 video
- mpegTsMux = MEncoderVideo.ID.equals(player.id()) && ((media_subtitle == null && media != null && media.dvdtrack == 0 && media.muxable
+ mpegTsMux = MEncoderVideo.ID.equals(player.id()) && ((media_subtitle == null && media != null && media.dvdtrack == 0
&& PMS.getConfiguration().isMencoderMuxWhenCompatible() && mediaRenderer.isMuxH264MpegTS())
|| mediaRenderer.isTranscodeToMPEGTSAC3());
}
if (mpegTsMux)
- dlnaspec = media.isH264()&&!VideoLanVideoStreaming.ID.equals(player.id())&&media.muxable?"DLNA.ORG_PN=AVC_TS_HD_24_AC3_ISO":"DLNA.ORG_PN=" + getMPEG_TS_SD_EU_ISOLocalizedValue(c);
+ dlnaspec = media.isH264()&&!VideoLanVideoStreaming.ID.equals(player.id())?"DLNA.ORG_PN=AVC_TS_HD_24_AC3_ISO":"DLNA.ORG_PN=" + getMPEG_TS_SD_EU_ISOLocalizedValue(c);
else
dlnaspec = "DLNA.ORG_PN=" + getMPEG_PS_PALLocalizedValue(c);
} else if(media != null){
3) TSMuxer does support mp4 containers and mencoder can extract the video and audio stream anyway:
- Code: Select all
--- net/pms/encoders/TSMuxerVideo.java
+++ net/pms/encoders/TSMuxerVideo.java
@@ -60,7 +60,7 @@
public boolean excludeFormat(Format extension) {
String m = extension.getMatchedId();
- return m != null && !m.equals("mkv") && !m.equals("ts") && !m.equals("tp") && !m.equals("m2ts") && !m.equals("m2t") && !m.equals("mpg") && !m.equals("evo") && !m.equals("mpeg") //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
+ return m != null && !m.equals("mp4") && !m.equals("mkv") && !m.equals("ts") && !m.equals("tp") && !m.equals("m2ts") && !m.equals("m2t") && !m.equals("mpg") && !m.equals("evo") && !m.equals("mpeg") //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
&& !m.equals("vob") && !m.equals("m2v") && !m.equals("mts"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
4) VLC in windows does not work with named pipes without extra backslashes. Streams pointing to a playlist instead of the videosource cause VLC to close the handle to the named pipe and then reopens it. This requires the forced reconnect option to function. Using the .asx or .aspx extension is a crude way to detect playlists.
- Code: Select all
--- net/pms/encoders/VideoLanVideoStreaming.java
+++ net/pms/encoders/VideoLanVideoStreaming.java
@@ -90,7 +90,7 @@
public ProcessWrapper launchTranscode(String fileName, DLNAMediaInfo media, OutputParams params) throws IOException {
- PipeProcess tsPipe = new PipeProcess("VLC" + System.currentTimeMillis()); //$NON-NLS-1$
+ PipeProcess tsPipe = new PipeProcess("VLC" + System.currentTimeMillis(),Platform.isWindows()&&(fileName.contains(".aspx")||fileName.contains(".asx"))?"reconnect":"");
params.input_pipes[0] = tsPipe;
@@ -101,7 +101,7 @@
cmdArray[0] = executable();
cmdArray[1] = "-I"; //$NON-NLS-1$
cmdArray[2] = "dummy"; //$NON-NLS-1$
- String trans = "#transcode{" + getEncodingArgs() + "}:duplicate{dst=std{access=file,mux=" + getMux() + ",dst=\"" +tsPipe.getInputPipe() + "\"}}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ String trans = "#transcode{" + getEncodingArgs() + "}:duplicate{dst=std{access=file,mux=" + getMux() + (Platform.isWindows()?",dst=\"\\\\\\":",dst=\"") +tsPipe.getInputPipe() + "\"}}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
if (Platform.isWindows()) {
cmdArray[3] = "--dummy-quiet"; //$NON-NLS-1$
cmdArray[4] = fileName;
5) YouTube has yet again changed the format. The following patch should be able to produce a working URL. By default it returns the highest resolution available(1080p,720p or 480p). Should work with the default MEncoder(at least it did for me).
- Code: Select all
--- net/pms/dlna/WebVideoStream.java
+++ net/pms/dlna/WebVideoStream.java
@@ -32,6 +32,7 @@
@Override
public InputStream getInputStream(long low, long high, double timeseek, RendererConfiguration mediaRenderer) throws IOException {
if (URL.toLowerCase().indexOf("youtube") > -1 && URL.toLowerCase().indexOf("?") > -1) {
+ //YouTube parsing: http://unlockforus.blogspot.com/2008/09/directly-download-youtube-videos-in.html
try {
InputStream is = downloadAndSend(URL, false);
ByteArrayOutputStream bout = new ByteArrayOutputStream();
@@ -42,42 +43,37 @@
}
is.close();
String content = new String(bout.toByteArray());
- int fs = content.indexOf("swfArgs");
- int hd = content.indexOf("isHDAvailable = true");
+ int fs = content.indexOf("swfHTML");
String newURL = "http://www.youtube.com/get_video%3F";
if (fs > -1) {
- String seq = content.substring(fs+18, content.indexOf("}", fs));
+ String seq = content.substring(content.indexOf("<param name=\\\"flashvars\\\"", fs));
+ seq = seq.substring(0, seq.indexOf(">"));
seq = seq.trim();
- StringTokenizer st = new StringTokenizer(seq, ",");
+ StringTokenizer st = new StringTokenizer(seq, "&");
while (st.hasMoreTokens()) {
String elt = st.nextToken();
- if (elt.startsWith(" \"video_id\""))
+ if (elt.startsWith("video_id="))
{
newURL += "&video_id%3D";
- newURL += elt.substring(14, elt.length()-1);
- if (hd>-1)newURL += "&fmt=22";
- else newURL += "&fmt=18";
+ newURL += elt.substring(9);
+ //if (hd>-1)newURL += "&fmt=22";
+ //else newURL += "&fmt=18";
}
- else if (elt.startsWith(" \"l\""))
- {
- newURL += "&l=";
- newURL += elt.substring(6, elt.length());
-
- }
- else if (elt.startsWith(" \"sk\""))
- {
- newURL += "&sk=";
- newURL += elt.substring(8, elt.length()-1);
-
- }
- else if (elt.startsWith(" \"t\""))
+ else if (elt.startsWith("t="))
{
newURL += "&t=";
- newURL += elt.substring(7, elt.length()-1);
+ newURL += elt.substring(2);
}
newURL = newURL.replace("=", "%3D");
}
- URL = newURL;
+ String[] fmts = {"37","22","18"};
+ for(String fmt : fmts){
+ URL = newURL+"&fmt%3D"+fmt;
+ java.net.URL url = new java.net.URL(URL);
+ int response = ((java.net.HttpURLConnection) url.openConnection()).getResponseCode();
+ if(response!=404)
+ break;
+ }
}
} catch (IOException e) {
PMS.error(null, e);
