[vlc-devel] [PATCH] cast: force transcoding of x265 videos

Thomas Guillem thomas at gllm.fr
Mon Sep 24 09:23:13 CEST 2018


Hello, I don't see any robust ways to detect chromecast flavors. Except, looking just for the chromecast name.

Normally, we first try hevc and then fallback to h264 if the chromecast can't support it. Is the fallback working for you ?
Why do you need this patch ? Because the fallback takes too long time ?

By the way, an other kind of issues can happen with 4K H264 or any high bitrate H264: the chromecast will accept it but won't be able to decode it. Therefore, I think you option should be used for any codecs.

On Thu, Sep 20, 2018, at 02:11, Erick Tyndall wrote:
> Auto-detecting the Chromecast version was my first thought as well.
> However, I spent a little over three days researching that idea. From
> what I can tell, Chromecast devices do not broadcast nor report
> version identification information.
> 
> As it stands, Chromecast playback does not work automatically for
> version 1 and 2 devices. The patch I wrote bypasses the acceptance of
> H265 by default. Since all 3 flavors support H264, I felt that it was
> prudent to set it as the default and allow the select few that want to
> cast H265 to their Chrome Ultra devices (bunch of elitists...)  opt
> out via the checkbox.
> 
> I also thought a lot about your last statement. I do wonder at the use
> cases for this. Are people more apt to travel (with vlc and videos in
> hand) to a location with an unknown Chromecast device? Or are they
> carrying all three with them? Or are they setting up a home media
> center that no longer has to be tethered to their TV? I actually
> wanted to go overboard and expose more of the available settings for
> x264 transcoding...(I spent the better part of 2 weeks testing almost
> every possible setting) but felt this was a safer and saner approach
> to test the waters.
> 
> On 19/09/2018 07:51, Steve Lhomme wrote:
> >
> > It might be better to detect the device flavor to know what codec it can
> > handle (so on the microdns side).
> >
> > Chromecast playback should work automatically, the user shouldn't have
> > to enable extra options. And given the versatility of Chromecast, one
> > time the user may be in an environment where the device supports H265
> > and not in other cases.
> >
> > On 19/09/2018 05:06, Erick Tyndall wrote:
> > >
> > > Allow users to transcode x265 encoded videos for playback on Chromecast
> > > version 1 and 2, as only Chromecast Ultra supports HEVC (H.265).
> > >
> > > ---
> > >  modules/stream_out/chromecast/cast.cpp | 12 +++++++++---
> > >  1 file changed, 9 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/modules/stream_out/chromecast/cast.cpp
> > > b/modules/stream_out/chromecast/cast.cpp
> > > index 2ef26d8eb4..b567b7a001 100644
> > > --- a/modules/stream_out/chromecast/cast.cpp
> > > +++ b/modules/stream_out/chromecast/cast.cpp
> > > @@ -115,7 +115,7 @@ struct sout_stream_sys_t
> > >          vlc_mutex_destroy(&lock);
> > >      }
> > >
> > > -    bool canDecodeVideo( vlc_fourcc_t i_codec ) const;
> > > +    bool canDecodeVideo( sout_stream_t* p_stream, vlc_fourcc_t i_codec )
> > > const;
> > >      bool canDecodeAudio( sout_stream_t* p_stream, vlc_fourcc_t i_codec,
> > >                           const audio_format_t* p_fmt ) const;
> > >      bool startSoutChain(sout_stream_t* p_stream,
> > > @@ -203,6 +203,9 @@ static const char *const ppsz_sout_options[] = {
> > >  #define PERF_LONGTEXT N_( "Display a performance warning when transcoding"
> > > )
> > >  #define AUDIO_PASSTHROUGH_TEXT N_( "Enable Audio passthrough" )
> > >  #define AUDIO_PASSTHROUGH_LONGTEXT N_( "Disable if your receiver does not
> > > support Dolby®." )
> > > +#define FORCE_TRANSCODE_TEXT N_( "Transcode x265 videos" )
> > > +#define FORCE_TRANSCODE_LONGTEXT N_( "Enable transcoding of x265 encoded
> > > videos." )
> > > +#define FORCE_TRANSCODE_DEFAULT true
> > >
> > >  enum {
> > >      CONVERSION_QUALITY_HIGH = 0,
> > > @@ -266,6 +269,7 @@ vlc_module_begin ()
> > >      add_integer(SOUT_CFG_PREFIX "show-perf-warning", 1, PERF_TEXT,
> > > PERF_LONGTEXT, true )
> > >          change_private()
> > >      add_bool(SOUT_CFG_PREFIX "audio-passthrough", false,
> > > AUDIO_PASSTHROUGH_TEXT, AUDIO_PASSTHROUGH_LONGTEXT, false )
> > > +    add_bool(SOUT_CFG_PREFIX "force-transcode", FORCE_TRANSCODE_DEFAULT,
> > > FORCE_TRANSCODE_TEXT, FORCE_TRANSCODE_LONGTEXT, false)
> > >      add_integer(SOUT_CFG_PREFIX "conversion-quality",
> > > CONVERSION_QUALITY_DEFAULT,
> > >                  CONVERSION_QUALITY_TEXT, CONVERSION_QUALITY_LONGTEXT,
> > > false );
> > >          change_integer_list(conversion_quality_list,
> > > conversion_quality_list_text)
> > > @@ -803,10 +807,12 @@ static void Del(sout_stream_t *p_stream, void *_id)
> > >   * Supported formats: https://developers.google.com/cast/docs/media
> > >   */
> > >
> > > -bool sout_stream_sys_t::canDecodeVideo( vlc_fourcc_t i_codec ) const
> > > +bool sout_stream_sys_t::canDecodeVideo( sout_stream_t *p_stream,
> > > vlc_fourcc_t i_codec ) const
> > >  {
> > >      if( transcoding_state & TRANSCODING_VIDEO )
> > >          return false;
> > > +    if( i_codec == VLC_CODEC_HEVC )
> > > +        return !(var_InheritBool( p_stream, SOUT_CFG_PREFIX
> > > "force-transcode" ));
> > >      return i_codec == VLC_CODEC_H264 || i_codec == VLC_CODEC_HEVC
> > >          || i_codec == VLC_CODEC_VP8 || i_codec == VLC_CODEC_VP9;
> > >  }
> > > @@ -1236,7 +1242,7 @@ bool sout_stream_sys_t::UpdateOutput( sout_stream_t
> > > *p_stream )
> > >          {
> > >              if (p_es->i_cat == VIDEO_ES && p_original_video == NULL)
> > >              {
> > > -                if (!canDecodeVideo( p_es->i_codec ))
> > > +                if (!canDecodeVideo( p_stream, p_es->i_codec ))
> > >                  {
> > >                      msg_Dbg( p_stream, "can't remux video track %d codec
> > > %4.4s",
> > >                               p_es->i_id, (const char*)&p_es->i_codec );
> > > --
> > > 2.17.1
> > > -------------- next part --------------
> > > An HTML attachment was scrubbed...
> > > URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20180918/cfba76ad/attachment.html>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list