Package: pelican-dashify
Pelican-dashifyPelican-dashify let you convert proper MPEG-DASH content generated from your videos with Pelican.FeaturesSupport for MPEG-DASH live and on-demand profiles, and evenmore.Transcode a video stream in multiple qualities, customizable with settings.Callable from any article or page metadata, by using the tag{dashify}.Seamless integration with Pelican, dashify does not include any HTML or JS extra code.DASHwhat?Many notable streming providers uses thisstandard, like YouTube or Netflix. MPEG-DASH let client adapt to changing network conditions and provide high quality playback with fewer stalls or re-buffering events. He is widely used on devices like Internet-connected televisions, TV set-top boxes, desktop computers, smartphones, tablets, etc. to consume multimedia content (video, TV, radio, etc.) delivered via the Internet.InstallationUnder the hood, dashify call for external binaries, which areffprobeto get input file info like resolution and metainfo.ffmpegis used to transcode the representations andMP4Boxto pack everything for delivery. Tests will be added to cover supported versions list, for now4.xof ff[mpeg/probe] and0.7.xof GPAC are fine.Install the latest release from PyPi :pipinstallpelican-dashifyQuickstartEnable dashify for your Pelican project into thepelicanconf.pyconfig file :PLUGINS=('pelican_dashify',)Download a video like theBig Bunnyinto the content directory, assuming path to becontent/videos/BigBuckBunny.mp4.Edit a dummy article, with a "DASHified" version of theBigBuckBunny.mp4attached :Big Buck Bunny==============:date:2018-11-12 23:00:summary:This is a MPEG-DASH compliant sample of the Big Buck Bunny:video:{dashify}videos/BigBuckBunny.mp4That's it, the site can be generated.make htmlGenerated filesTranscoded representations are stored in a cache-like directory to avoid a re-transcoding on every site generation.output/videos/BigBuckBunny.mp4/.cache/1280x720_2211k.mp4
output/videos/BigBuckBunny.mp4/.cache/640x360_552k.mp4
output/videos/BigBuckBunny.mp4/.cache/320x180_138k.mp4
output/videos/BigBuckBunny.mp4/.cache/audio_128k.mp4Since these files are stored in the Pelican output directory by default, they will be removed on cleaning, which leads to re-transcode. To avoid this behavior, setDASHIFY_CACHE_PATHoutside the output scope.Just after, on packing phase, representations are segmented by MP4Box and placed in the output directory.
FromBigBuckBunny.mp4, using the default DASH profile 'onDemand', following files have been generated :output/videos/BigBuckBunny.mp4/manifest.mpd
output/videos/BigBuckBunny.mp4/1280x720_2211k_dash_track1_init.mp4
output/videos/BigBuckBunny.mp4/640x360_552k_dash_track1_init.mp4
output/videos/BigBuckBunny.mp4/320x180_138k_dash_track1_init.mp4
output/videos/BigBuckBunny.mp4/audio_128k_dash_track1_init.mp4To serve representations using theonDemandprofile, the HTTP server must support range requests. As a workaround, theliveprofile can be used.Video displayingNow the content has been generated, but Pelican doesn't know how and where to display the video. To do this, a modification of your template is required.
You can use any DASH player to read your converted video, for this example, we choose video.js for less code as possible.Intoarticle.html:{%extends"base.html"%}...{%blockcontent%}<section id="content" class="body">...<div class="entry-content">{%ifarticle.video%}<video data-dashjs-player autoplay src="{{SITEURL}}/{{article.video.url}}" controls></video><div class="video-duration">{{article.video.duration|timedelta_as_string}}</div>{%endif%}{{article.content}}</div><!-- /.entry-content --></section><script src="https://cdn.dashjs.org/latest/dash.all.min.js"></script>{%endblock%}Thetimedelta_as_stringare provided by Pelican-dashify.SettingsSettings can be defined globaly intopelicanconf.pyor per video using a specific JSON file.
To define a video configuration, like a custom DASH profile forBigBuckBunny.mp4, create a file namedBigBuckBunny.mp4.dashify.configwith the following content :{"DASHIFY_DASH_PROFILE":"live"}GeneralDASHIFY_EXTRACT_TAGS:	Inject the original video tags into the template variable{{ <metaname>.tags }}. Default toFalse.DASHIFY_CACHE_PATH:	Use a custom path to store the representations transcoded from the original video.
By default, dashify will store them into the content directory. Default toNone.DASHIFY_FFMPEG_BIN:	Specific path to use for the ffmpeg binary, libav can be used. Default toffmpeg.DASHIFY_FFPROBE_BIN:	Specific path to use for the ffprobe binary. Default toffprobe.DASHIFY_MP4BOX_BIN:	Specific path to use for the MP4Box binary. Default toMP4Box.DASHIFY_METATAG:	Tag used to prefix video to be DASHified. Default to{dashify}.TranscodingDASHIFY_RESOLUTION_DIVISOR:	The divisor used to downscale the resolution of representations. Default is2.For a 720p formatted input, the 1280x720, 640x360 and 320x180 will be generated withDASHIFY_VIDEO_REPRESENTATIONSset to 3.DASHIFY_VIDEO_REPRESENTATIONS:	How many representations to generate. Default to3.DASHIFY_SEGMENT_DURATION:	The time of a DASH segment in seconds, used to switch between the different video/audio qualities.Dashify will compute the ffmpeg keyint accordingly. Default to4.DASHIFY_BITS_PER_PIXEL:	The BPP used to compute the bitrate for a given resolution. Default to0.1.DASHIFY_DASH_PROFILE:	Choices are :onDemand,live,main,simple,full,dashavc264:live,dashavc264:onDemand.Default toonDemand.VideoDASHIFY_FRAMERATE:	The frames per second to use on representations. Default to24fps.DASHIFY_X264_PRESET:	Preset used by ffmpeg on transcoding. Default toslowfor a better rendering.Choices are :ultrafast,superfast,veryfast,faster,fast,medium,slow,slower,veryslow.For more info check theffmpeg wiki.DASHIFY_VIDEO_STREAM_INDEX:	Select a given stream from the input container. Default to0for the first available one.DASHIFY_VIDEO_MAX_WIDTH:	Skip representation if computed width is greater then value. Default to7680(8K).DASHIFY_VIDEO_MAX_HEIGHT:	Skip representation if computed height is greater then value. Default to4320(8K).DASHIFY_VIDEO_MAX_BITRATE:	Skip representation if computed bitrate is greater then value. Default to79626(8K w/ 0.1 BPP @ 24fps).DASHIFY_VIDEO_MIN_WIDTH:	Skip representation if computed width is lower then value. Default to128.DASHIFY_VIDEO_MIN_HEIGHT:	Skip representation if computed height is lower then value. Default to72.DASHIFY_VIDEO_MIN_BITRATE:	Skip representation if computed bitrate width is lower then value. Default to22.AudioDASHIFY_AUDIO_STREAM_INDEX:	Select a given stream from the input container. Default to0for the first available one.DASHIFY_AUDIO_CODEC:	Codec to use on audio transcoding. Default toaac.DASHIFY_AUDIO_CHANNELS:	Number of audio channels. Default to2.DASHIFY_AUDIO_BITRATE:	Default to128k.DASHIFY_AUDIO_DISABLE:	Disable audio. Default toFalse.