- -
-

pyams_media package

- -
-

Submodules

-
-
-

pyams_media.audio module

-
-
-class pyams_media.audio.AudioTypeAdapter(context)
-

Bases: pyams_utils.adapter.ContextAdapter

-

Default audio content type adapter

-
-
-audio_type
-
- -
- -
-
-class pyams_media.audio.AudioTypeExtension(context, request, view)
-

Bases: pyams_utils.adapter.ContextRequestViewAdapter

-

extension:audio_type(media) TALES extension

-
-
-render(context=None)
-
- -
- -
-
-

pyams_media.converter module

-
-
-class pyams_media.converter.AudioConvertersVocabulary(context=None)
-

Bases: zope.schema.vocabulary.SimpleVocabulary

-

Audio converters vocabulary

-
- -
-
-class pyams_media.converter.BaseAudioConverter
-

Bases: pyams_media.converter.BaseMediaConverter

-

Base media converter

-
-
-add_common_filters(document)
-
- -
- -
-
-class pyams_media.converter.BaseMediaConverter
-

Bases: object

-

Base media converter

-
-
-add_common_filters(document)
-
- -
-
-add_filters(document)
-
- -
-
-convert(media)
-

Convert media

-
- -
-
-format = None
-
- -
-
-get_conversion_loop(document)
-
- -
-
-require_input_file(media)
-

Check if a physical file is required to handle conversion

-
- -
-
-require_temp_file = False
-
- -
- -
-
-class pyams_media.converter.BaseVideoConverter
-

Bases: pyams_media.converter.BaseMediaConverter

-

Base video converter

-
-
-add_filters(document)
-
- -
-
-get_conversion_loop(document)
-
- -
- -
-
-class pyams_media.converter.FlvVideoConverter
-

Bases: pyams_media.converter.BaseVideoConverter

-

Default FLV media converter

-
-
-add_common_filters(document)
-
- -
-
-format = 'flv'
-
- -
-
-label = 'FLV (Flash Video) video converter'
-
- -
- -
-
-class pyams_media.converter.Mp3AudioConverter
-

Bases: pyams_media.converter.BaseAudioConverter

-

Default MP3 media converter

-
-
-format = 'mp3'
-
- -
-
-label = 'MP3 audio converter'
-
- -
- -
-
-class pyams_media.converter.Mp4VideoConverter
-

Bases: pyams_media.converter.BaseVideoConverter

-

Default MP4 media converter

-
-
-add_common_filters(document)
-
- -
-
-format = 'mp4'
-
- -
-
-label = 'MP4 (HTML5) video converter'
-
- -
-
-require_temp_file = True
-
- -
- -
-
-class pyams_media.converter.OggAudioConverter
-

Bases: pyams_media.converter.BaseAudioConverter

-

Default OGG audio converter

-
-
-format = 'ogg'
-
- -
-
-label = 'OGG audio converter'
-
- -
- -
-
-class pyams_media.converter.OggVideoConverter
-

Bases: pyams_media.converter.BaseVideoConverter

-

OGG media converter

-
-
-format = 'ogg'
-
- -
-
-label = 'OGG video converter'
-
- -
- -
-
-class pyams_media.converter.VideoConvertersVocabulary(context=None)
-

Bases: zope.schema.vocabulary.SimpleVocabulary

-

Video converters vocabulary

-
- -
-
-class pyams_media.converter.WavAudioConverter
-

Bases: pyams_media.converter.BaseAudioConverter

-

Default WAV media converter

-
-
-format = 'wav'
-
- -
-
-label = 'WAV audio converter'
-
- -
- -
-
-class pyams_media.converter.WebmVideoConverter
-

Bases: pyams_media.converter.BaseVideoConverter

-

WebM Media converter

-
-
-add_common_filters(document)
-
- -
-
-format = 'webm'
-
- -
-
-label = 'WebM video converter'
-
- -
-
-require_temp_file = True
-
- -
- -
-
-

pyams_media.ffbase module

-
-
-class pyams_media.ffbase.FFmpeg(cmd='avconv')
-

Bases: object

-

FFmpeg Wrapper

-
-
-info(input)
-

Retrieve file information parsing command output

-
- -
-
-re_audioline = re.compile('^\\s*Stream #(\\d+:\\d+?)\\(?([A-Za-z]*)\\)?: Audio: (.*?), (\\d+?) Hz, (.*?), (.*?), (\\d+?) kb\\/s$')
-
- -
-
-re_infoline = re.compile('^\\s*Duration: (.*?), start: 0\\.000000, bitrate: (\\d+?) kb\\/s$')
-
- -
-
-re_mainline = re.compile("^\\s*Input #(\\d+?), (.*?), from '(.*?)':$")
-
- -
-
-re_videoline = re.compile('^\\s*Stream #(\\d+:\\d+?)\\(?([A-Za-z]*)\\)?: Video: (.*?), (.*?), (.*?), (.*?)$')
-
- -
-
-render(effectchain, output)
-

Create a new file by chaining audio/video effects

-
- -
- -
-
-class pyams_media.ffbase.FFVideoEffect(inputfile=None, **args)
-

Bases: pyams_media.ffbase.FFEffect

-

video effect

-
-
-aspect(aspect=None)
-

set aspect ratio

-
- -
-
-bitrate(b=None)
-

set video bitrate

-
- -
-
-bitraterange(minrate=None, maxrate=None)
-

set min/max bitrate (bit/s)

-
- -
-
-bitratetolerance(bt=None)
-

set bitrate tolerance

-
- -
-
-bufsize(bufsize=4096)
-

set buffer size (bits)

-
- -
-
-crop(top=0, bottom=0, left=0, right=0)
-

set the crop size

-
- -
-
-intra()
-

use only intra frames

-
- -
-
-lagrangefactor(lmin=None, lmax=None)
-

min/max lagrange factor

-
- -
-
-macroblock(mblmin=None, mblmax=None)
-

min/max macroblock scale

-
- -
-
-pad(top=0, bottom=0, left=0, right=0, color='000000')
-

set the pad band size and color as hex value

-
- -
-
-passenc(p=1)
-

select pass number (1 or 2)

-
- -
-
-picturesize(gop=None)
-

set of group pictures size

-
- -
-
-pixelformat(p=None)
-

set pixelformat

-
- -
-
-quantizerblur(qblur=None)
-

video quantizer scale blur

-
- -
-
-quantizercompression(qcomp=0.5)
-

video quantizer scale compression

-
- -
-
-quantizerrange(qmin=None, qmax=None, qdiff=None)
-

define min/max quantizer scale

-
- -
-
-quantizerscale(qscale=None)
-

Fixed quantizer scale

-
- -
-
-rate(r=None)
-

set frame rate

-
- -
-
-sameq()
-

use same video quality as source

-
- -
-
-size(s=None)
-

set frame size

-
- -
-
-unset_aspect()
-
- -
-
-unset_bitrate()
-
- -
-
-unset_bitraterange()
-
- -
-
-unset_bitratetolerance()
-
- -
-
-unset_bufsize()
-
- -
-
-unset_crop()
-
- -
-
-unset_intra()
-
- -
-
-unset_lagrangefactor()
-
- -
-
-unset_macroblock()
-
- -
-
-unset_pad()
-
- -
-
-unset_passenc()
-
- -
-
-unset_picturesize()
-
- -
-
-unset_pixelformat()
-
- -
-
-unset_quantizerblur()
-
- -
-
-unset_quantizercompression()
-
- -
-
-unset_quantizerrange()
-
- -
-
-unset_quantizerscale()
-
- -
-
-unset_rate()
-
- -
-
-unset_sameq()
-
- -
-
-unset_size()
-
- -
-
-unset_vcodec()
-
- -
-
-unset_vdthreshold()
-
- -
-
-unset_vframes()
-
- -
-
-unset_vn()
-
- -
-
-vcodec(vcodec='copy')
-

set video codec

-
- -
-
-vdthreshold(vdt=None)
-

discard threshold

-
- -
-
-vframes(vframes=None)
-

set number of video frames to record

-
- -
-
-vn()
-

disable video recording

-
- -
- -
-
-class pyams_media.ffbase.FFAudioEffect(inputfile, **args)
-

Bases: pyams_media.ffbase.FFEffect

-

Audio effect

-
-
-acodec(acodec='copy')
-

select audio codec

-
- -
-
-aframes(aframes=None)
-

set number of audio frames to record

-
- -
-
-audiobitrate(ab=64)
-

set audio bitrate (kbit/s)

-
- -
-
-audiochannels(ac=1)
-

set number of audio channels

-
- -
-
-audiorecording()
-

disable audio recording

-
- -
-
-audiosampling(ar=44100)
-

set audio sampling frequency (Hz)

-
- -
-
-newaudio()
-

add new audio track

-
- -
-
-unset_acodec()
-
- -
-
-unset_aframes()
-
- -
-
-unset_audiobitrate()
-
- -
-
-unset_audiochannels()
-
- -
-
-unset_audiorecording()
-
- -
-
-unset_audiosampling()
-
- -
-
-unset_newaudio()
-
- -
- -
-
-

pyams_media.ffdocument module

-
-
-class pyams_media.ffdocument.FFDocument(file, metadata=None, effects={})
-

Bases: pyams_media.ffbase.FFVideoEffect, pyams_media.ffbase.FFAudioEffect

-

audio/video document. A FFDocument describe a higer level action set -combining several FF[Audio|Video]Effect methods.

-
-
-chainto(ffdoc)
-

Prepare to append at the end of another movie clip

-
- -
-
-get_stream_info(codec_type=None)
-

Get metadata info for given stream

-
- -
-
-ltrim(time)
-

Trim leftmost side (from start) of the clip

-
- -
-
-resample(width=0, height=0, vstream=0)
-

Adjust video dimensions. If one dimension is specified, the re-sampling is proportional

-
- -
-
-resize(width=0, height=0, vstream=0)
-

Resize video dimensions. If one dimension is specified, the re-sampling is proportional

-

Width and height can be pixel or % (not mixable)

-
- -
-
-rtrim(time)
-

Trim rightmost side (from end) of the clip

-
- -
-
-split(time)
-

Return a tuple of FFDocument splitted at a specified time.

-

Allowed formats: %, sec, hh:mm:ss.mmm

-
- -
-
-trim(left, right)
-

Left and right trim (actually calls ltrim and rtrim)

-
- -
- -
-
-

pyams_media.ffexception module

-
-
-exception pyams_media.ffexception.FFException(value)
-

Bases: Exception

-
- -
-
-

pyams_media.include module

-
-
-pyams_media.include.handle_new_application(event)
-

Start converter process when application created

-
- -
-
-pyams_media.include.include_package(config)
-

Pyramid include

-
- -
-
-

pyams_media.media module

-
-
-class pyams_media.media.ConversionsExtension(context, request, view)
-

Bases: pyams_utils.adapter.ContextRequestViewAdapter

-

extension:conversions(media) TALES extension

-
-
-render(context=None)
-
- -
- -
-
-class pyams_media.media.MediaConversions
-

Bases: zope.container.folder.Folder

-

Media conversions

-
-
-add_conversion(conversion, format, extension=None, width=None)
-
- -
-
-static get_conversion_width(name)
-
- -
-
-get_conversions(with_source=False, order=None)
-
- -
-
-has_conversion(formats)
-
- -
- -
-
-pyams_media.media.MediaConversionsFactory(context)
-

Media conversions factory

-
- -
-
-class pyams_media.media.MediaConversionsTraverser(context)
-

Bases: pyams_utils.adapter.ContextAdapter

-

++conversions++ file traverser

-
-
-traverse(name, furtherpath=None)
-
- -
- -
-
-pyams_media.media.MediaInfoFactory(context)
-

Media info adapter

-
- -
-
-pyams_media.media.check_media_conversion(status, media)
-
- -
-
-pyams_media.media.handle_added_media(event)
-

Handle added media file

-
- -
-
-

pyams_media.process module

-
-
-class pyams_media.process.ConversionProcess(settings, group=None, target=None, name=None, *args, **kwargs)
-

Bases: multiprocessing.context.Process

-

Media conversion process

-
-
-run()
-
- -
- -
-
-class pyams_media.process.ConversionThread(process)
-

Bases: threading.Thread

-

Media conversion thread

-
-
-run()
-
- -
- -
-
-class pyams_media.process.MediaConversionHandler
-

Bases: object

-

Media conversion handler

-
-
-convert(settings)
-
- -
-
-test(settings)
-
- -
- -
-
-class pyams_media.process.MediaConversionMessageHandler(process, stream, stop, handler=None, json_load=-1)
-

Bases: pyams_zmq.handler.ZMQMessageHandler

-

Media conversion message handler

-
-
-handler
-

alias of MediaConversionHandler

-
- -
- -
-
-class pyams_media.process.MediaConversionProcess(zmq_address, handler, registry)
-

Bases: pyams_zmq.process.ZMQProcess

-

Media conversion ZMQ process

-
- -
-
-

pyams_media.site module

-
-
-class pyams_media.site.MediaConversionGenerationsChecker
-

Bases: object

-

Medias conversion utility generations checker

-
-
-evolve(site, current=None)
-

Check for required utilities

-
- -
-
-generation = 1
-
- -
- -
-
-pyams_media.site.handle_new_local_site(event)
-

Create a new conversion utility when a site is created

-
- -
-
-

pyams_media.utility module

-
-
-class pyams_media.utility.MediaConversionUtility
-

Bases: persistent.Persistent, zope.container.contained.Contained

-

Medias conversions utility

-
-
-audio_bitrate
-

Computed attributes based on schema fields

-

Field properties provide default values, data validation and error messages -based on data found in field meta-data.

-

Note that FieldProperties cannot be used with slots. They can only -be used for attributes stored in instance dictionaries.

-
- -
-
-audio_formats
-

Computed attributes based on schema fields

-

Field properties provide default values, data validation and error messages -based on data found in field meta-data.

-

Note that FieldProperties cannot be used with slots. They can only -be used for attributes stored in instance dictionaries.

-
- -
-
-audio_sampling
-

Computed attributes based on schema fields

-

Field properties provide default values, data validation and error messages -based on data found in field meta-data.

-

Note that FieldProperties cannot be used with slots. They can only -be used for attributes stored in instance dictionaries.

-
- -
-
-check_media_conversion(media)
-

Check if conversion is needed for given media

-
- -
-
-convert(media, format)
-

Send conversion request for given media

-
- -
-
-test_process()
-

Send test request to conversion process

-
- -
-
-video_audio_bitrate
-

Computed attributes based on schema fields

-

Field properties provide default values, data validation and error messages -based on data found in field meta-data.

-

Note that FieldProperties cannot be used with slots. They can only -be used for attributes stored in instance dictionaries.

-
- -
-
-video_audio_sampling
-

Computed attributes based on schema fields

-

Field properties provide default values, data validation and error messages -based on data found in field meta-data.

-

Note that FieldProperties cannot be used with slots. They can only -be used for attributes stored in instance dictionaries.

-
- -
-
-video_bitrate
-

Computed attributes based on schema fields

-

Field properties provide default values, data validation and error messages -based on data found in field meta-data.

-

Note that FieldProperties cannot be used with slots. They can only -be used for attributes stored in instance dictionaries.

-
- -
-
-video_formats
-

Computed attributes based on schema fields

-

Field properties provide default values, data validation and error messages -based on data found in field meta-data.

-

Note that FieldProperties cannot be used with slots. They can only -be used for attributes stored in instance dictionaries.

-
- -
-
-video_frame_size
-

Computed attributes based on schema fields

-

Field properties provide default values, data validation and error messages -based on data found in field meta-data.

-

Note that FieldProperties cannot be used with slots. They can only -be used for attributes stored in instance dictionaries.

-
- -
-
-video_quantisation
-

Computed attributes based on schema fields

-

Field properties provide default values, data validation and error messages -based on data found in field meta-data.

-

Note that FieldProperties cannot be used with slots. They can only -be used for attributes stored in instance dictionaries.

-
- -
-
-zodb_name
-

Computed attributes based on schema fields

-

Field properties provide default values, data validation and error messages -based on data found in field meta-data.

-

Note that FieldProperties cannot be used with slots. They can only -be used for attributes stored in instance dictionaries.

-
- -
- -
-
-

pyams_media.video module

-
-
-class pyams_media.video.FlashVideoTypeAdapter(context)
-

Bases: pyams_utils.adapter.ContextAdapter

-

Flash video content type adapter

-
-
-video_type
-
- -
- -
-
-class pyams_media.video.ThumbnailTraverser(context)
-

Bases: pyams_utils.adapter.ContextAdapter

-

++thumb++ video namespace traverser

-
-
-traverse(name, furtherpath=None)
-
- -
- -
-
-class pyams_media.video.VideoThumbnailAdapter(video)
-

Bases: object

-

Video thumbnail adapter

-
-
-clear_geometries()
-
- -
-
-clear_thumbnails()
-
- -
-
-delete_thumbnail(thumbnail_name)
-
- -
-
-get_geometry(selection_name)
-
- -
-
-get_image_size()
-
- -
-
-get_thumbnail(thumbnail_name, format=None, time=5)
-
- -
-
-get_thumbnail_name(thumbnail_name, with_size=False)
-
- -
-
-get_thumbnail_size(thumbnail_name, forced=False)
-
- -
-
-set_geometry(selection_name, geometry)
-
- -
- -
-
-class pyams_media.video.VideoTypeAdapter(context)
-

Bases: pyams_utils.adapter.ContextAdapter

-

Default video content type adapter

-
-
-video_type
-
- -
- -
-
-class pyams_media.video.VideoTypeExtension(context, request, view)
-

Bases: pyams_utils.adapter.ContextRequestViewAdapter

-

extension:video_type(media) TALES extension

-
-
-render(context=None)
-
- -
- -
-
-

Module contents

-
-
-pyams_media.includeme(config)
-

Pyramid include

-
- -
-
- - -