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

Erick Tyndall erythros at gmail.com
Mon Sep 24 20:57:53 CEST 2018


Hello,

I have tested the fallback function but it does not seem to fire for
HEVC/H.265 videos. I can append a log if needed, but no error occurs.
I can see that 'p_intf->setRetryOnFail(transcodingCanFallback())' is
called and 'm_retry_on_fail' is being set correctly. However, I will
have to do further testing to see why it is not being recognized
within 'static void on_input_event_cb()'... unless the fallback occurs
somewhere else that I am not tracking.

I agree that this option can be used for various codec failures rather
than just as a fallback for HEVC/H.265, although I have yet to witness
any other failures with accepted codecs (other than HEVC/H.265). Now
that you have brought up the idea of possible issues at higher
bitrates, I will include those in my tests. I initially developed this
as one of 5 test patches
(https://github.com/sorhtyre/vlc-3.0/commits/3.0.4.1?author=sorhtyre)
I made against v3.0.4 in order to provide better stability and quality
for videos being casted via vlc (linux and android)
On Mon, Sep 24, 2018 at 3:23 AM Thomas Guillem <thomas at gllm.fr> wrote:
>
> 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
> _______________________________________________
> 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