How to skip transcoding of YouTube Streaming?

For help and support with PS3 Media Server in general
Forum rules
Please make sure you follow the Problem Reporting Guidelines before posting if you want a reply.

How to skip transcoding of YouTube Streaming?

Postby keroppi » Sun Aug 11, 2013 3:16 am

I want to do direct streaming of YouTube video, but pmsencoder always do transcode

My renderer config

MediaInfo=true
Supported = f:mp4 v:mp4|h264 a:ac3 m:video/mp4
Supported = f:mp4 v:mp4|h264 a:aac m:video/mp4 n:2

Debug.log
DEBUG 2013-08-11 10:03:23.158 [ffmpeg.exe-2] Starting "C:\Program Files\PS3 Media Server\win32\ffmpeg.exe" -loglevel warning -y -threads 4 -i "http://r2---sn-i3co-i3bd.c.youtube.com/videoplayback?itag=37&sparams=cp%2Cid%2Cip%2Cipbits%2Citag%2Cratebypass%2Csource%2Cupn%2Cexpire&ip=58.177.8.227&key=yt1&cp=U0hWS1JMT19LS0NONl9KRlNHOm50UzMtN21CSUh6&upn=Okq_gQD3sj0&sver=3&fexp=929813%2C933602%2C926514%2C916624%2C909546%2C906397%2C929117%2C929121%2C929906%2C929907%2C929127%2C929129%2C929131%2C929930%2C925720%2C925722%2C925718%2C925714%2C929917%2C929919%2C912521%2C932306%2C920605%2C904830%2C919373%2C904122%2C929609%2C911423%2C909549%2C900816%2C912711%2C935802%2C904494%2C906001&source=youtube&expire=1376211661&id=a435df71f2e560ca&mv=m&mt=1376186552&ms=au&ipbits=8&ratebypass=yes&signature=233ABF2399705A95BCC1DFE6CD69C8096CC2D9D2.0D7CC824709E6F0EE45607777ECD2639C86B5B10" -threads 4 -q:a 3 -q:v 3 -c:a ac3 -c:v mpeg2video -f vob \\.\pipe\pmsencoder_transcoder_out_1376186602220_68


HTTP Header of the above youtube real link
Content-Length: [1020756812]
Expires: [Sun, 11 Aug 2013 02:10:21 GMT]
Last-Modified: [Sat, 10 Aug 2013 10:22:06 GMT]
Alternate-Protocol: [80:quic]
Content-Type: [video/mp4]
Accept-Ranges: [bytes]
Connection: [close]
Server: [gvs 1.0]
Cache-Control: [private, max-age=24340]
X-Content-Type-Options: [nosniff]

When i save the video as local, i found the codec info for video as below
Video: H264 - MPEG-4 AVC (part 10) (avc1)
Audio: MPEG AAC Audio (mp4a)

PMS can play it directly, i can confirm that pmsencoder no longer used and it just does direct sending data.

Does pmsencoder always use ffmpeg.exe as a middle man to create a pipe as a middle man to bride the streaming, but even so, can it just do a direct streaming without doing any transcoding? or my config is wrong?

thank you very much.
keroppi
 
Posts: 5
Joined: Tue Jul 10, 2012 9:39 am

Re: How to skip transcoding of YouTube Streaming?

Postby keroppi » Sun Aug 11, 2013 3:31 pm

i browse through the source code and there is some hint but I still don't know how the following logic will provide me the copy option

Code: Select all
         if (isAc3Remux()) {
            // AC-3 remux
            options.add("-c:a");
            options.add("copy");

isAc3Remux() is true if below is true
Code: Select all
      if (configuration.isAudioRemuxAC3() && params.aid != null && params.aid.isAC3() && renderer.isTranscodeToAC3()) {
         // AC-3 remux takes priority
         setAc3Remux(true);


configuration.isAudioRemuxAC3() is true if PMS.conf contains audio_remux_ac3 = true
renderer.isTranscodeToAC3() is true if the renderer contains TranscodeVideo=H264TSAC3 or MPEGPSAC3 or MPEGTSAC3

the only thing i am not quite sure is params.aid.isAC3()
i guess it is parsed from the link itself.
can anyone give me hint?

thank you
Last edited by Raptor399 on Sun Aug 11, 2013 7:52 pm, edited 1 time in total.
Reason: Edited for code fragments
keroppi
 
Posts: 5
Joined: Tue Jul 10, 2012 9:39 am

Re: How to skip transcoding of YouTube Streaming?

Postby keroppi » Sun Aug 11, 2013 3:58 pm

Code: Select all
// Output video codec
         if (media.isMediaparsed()
               && params.sid == null
               && ((newInput != null && media.isVideoWithinH264LevelLimits(newInput, params.mediaRenderer))
                  || !params.mediaRenderer.isH264Level41Limited())
               && media.isMuxable(params.mediaRenderer)
               && configuration.isFFmpegMuxWhenCompatible()
               && params.mediaRenderer.isMuxH264MpegTS()) {

            options.add("-c:v");
            options.add("copy");
            options.add("-bsf");
            options.add("h264_mp4toannexb");
            options.add("-fflags");
            options.add("+genpts");

below made me disappointed if it only works for local file rather than streaming from another source because i guess isMuxable() is always false
correct me if I am wrong.
thank you


Code: Select all
/**
    * Used to determine whether tsMuxeR can mux the file instead of transcoding.
    * Also used by DLNAResource to help determine the DLNA.ORG_PN (file type)
    * value to send to the renderer, which is confusing.
    *
    * Some of this code is repeated in isVideoWithinH264LevelLimits(), and since
    * both functions are sometimes (but not always) used together, this is
    * not an efficient use of code.
    * TODO: Fix the above situation.
    * TODO: Now that FFmpeg is muxing without tsMuxeR, we should make a separate
    *       function for that, or even better, re-think this whole approach.
    */
   public boolean isMuxable(RendererConfiguration mediaRenderer) {
      boolean muxable = false;
      // Allow the formats in the following list
      if (
            getContainer() != null &&
                  (
                        getContainer().equals("mkv") ||
                              getContainer().equals("mp4") ||
                              getContainer().equals("mov") ||
                              getContainer().equals("ts") ||
                              getContainer().equals("m2ts")
                  )
            ) {
         if (
               getCodecV() != null &&
                     (
                           getCodecV().equals("h264") ||
                                 getCodecV().equals("vc1") ||
                                 getCodecV().equals("mpeg2")
                     )
               ) {
            if (getFirstAudioTrack() != null) {
               String codecA;
               codecA = getFirstAudioTrack().getCodecA();
               if (
                     codecA != null &&
                           (
                                 codecA.equals("aac") ||
                                       codecA.equals("ac3") ||
                                       codecA.equals("dca") ||
                                       codecA.equals("dts") ||
                                       codecA.equals("eac3")
                           )
                     ) {
                  muxable = true;
               }
            }
         }
      }

      // Temporary fix: MediaInfo support will take care of this in the future
      // For now, http://ps3mediaserver.org/forum/viewtopic.php?f=11&t=6361&start=0
      // Bravia does not support AVC video at less than 288px high
      if (mediaRenderer.isBRAVIA() && getHeight() < 288) {
         muxable = false;
      }
Last edited by Raptor399 on Sun Aug 11, 2013 7:52 pm, edited 1 time in total.
Reason: Edited for code fragments
keroppi
 
Posts: 5
Joined: Tue Jul 10, 2012 9:39 am


Return to General Help and Support

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 16 guests