Topic on Extension talk:TimedMediaHandler

How to enable transcoding to H.264 ?

9
Dieudo (talkcontribs)

Default enabled transcodes :

 $wgEnabledTranscodeSet = array(
        // A high end web streamable ogg video 
        WebVideoTranscode::ENC_OGV_480P,
 
        // A web low bandwidth streamable WebM video    
        WebVideoTranscode::ENC_WEBM_360P,
 
        // A web streamable WebM video  
        WebVideoTranscode::ENC_WEBM_480P,
 
        // A high quality WebM stream 
        WebVideoTranscode::ENC_WEBM_720P,

How do we specify enabling transcoding to H.264 in order to have this format available as seen in Extension:TimedMediaHandler/Platform testing ?

Dieudo (talkcontribs)

The beginning of a solution in the file TimedMediaHandler.php :

Extract :

/**
 * Default enabled transcodes
 *
 * -If set to empty array, no derivatives will be created
 * -Derivative keys encode settings are defined in WebVideoTranscode.php
 *
 * -These transcodes are *in addition to* the source file.
 * -Only derivatives with smaller width than the source asset size will be created
 * -Regardless of source size at least one WebM and Ogg source will be created from the $wgEnabledTranscodeSet
 * -Derivative jobs are added to the MediaWiki JobQueue the first time the asset is displayed
 * -Derivative should be listed min to max
 */
$wgEnabledTranscodeSet = array(
	// Small WebM version for default small embed size thumbs
	WebVideoTranscode::ENC_WEBM_360P,

	// Ogg fallback for IE/cortado
	WebVideoTranscode::ENC_OGV_480P,

	// A web streamable WebM video
	WebVideoTranscode::ENC_WEBM_480P,

	// A high quality WebM stream
	WebVideoTranscode::ENC_WEBM_720P,

	// A least common denominator h.264 stream; first gen iPhone, iPods, early android etc.
	WebVideoTranscode::ENC_H264_320P,

	// A mid range h.264 stream; mid range phones and low end tables
	WebVideoTranscode::ENC_H264_480P,
/*
	// An high quality HD stream; higher end phones, tablets, smart tvs
	WebVideoTranscode::ENC_H264_720P,
*/
);

$wgEnabledAudioTranscodeSet = array(
	WebVideoTranscode::ENC_OGG_VORBIS,

	//opus support must be available in avconv
	//WebVideoTranscode::ENC_OGG_OPUS,

	//avconv needs libmp3lame support
	//WebVideoTranscode::ENC_MP3,

	//avconv needs libvo_aacenc support
	WebVideoTranscode::ENC_AAC,
);

// If mp4 source assets can be ingested:
$wgTmhEnableMp4Uploads = true;

But even set as above the h.264 and transcoded, this format remains not visible in the choices offered.

Below a copy of what it looks like :

Any idea where is the bug ?

Mdale (talkcontribs)

Once you change any transcode setting you should clear out all your transcodes. ( see maintenance/cleanupTranscodes.php )

Also you should check that the commands being run will work to generate your mp4 files. i.e run the maintenance/WebVideoJobRunner.php job on the command line and observer the ffmpeg commands being called and confirm they are are successfully being executed.

Dieudo (talkcontribs)

Thank you Mdale for theses informations.

I'll try them.

But even before that isn't there another problem shown by the fact that when I upload an mp4 file it's not readable by TMH : it only gives this message :

For best viewing, using an HTML 5 broswer is recommanded.

even though it is viewed with Firefox.

And I confirm the commands were successfully being executed :

2013-03-08 09:34:12 webVideoTranscode Fichier:Patrick_Viveret-Oct_2010.webm transcodeMode=derivative transcodeKey=320p.mp4 STARTING
Encoding to codec: h264
Running cmd: 

'/usr/bin/avconv' -y -i '/var/www/rc/images/Patrick_Viveret-Oct_2010.webm' -threads 1 -vcodec libx264 -profile:v baseline -preset slow -coder 0 -bf 0 -flags2 -wpred-dct8x8 -level 13 -maxrate 768k -bufsize 3M -b '400k' -f mp4 -s 426x320 -ab 40000 -ac '2' -acodec 'libvo_aacenc' /tmp/transcode_320p.mp422999f1774bc-1.mp4

2013-03-08 09:39:15 webVideoTranscode Fichier:Patrick_Viveret-Oct_2010.webm transcodeMode=derivative transcodeKey=320p.mp4 t=302868 good

Do theses informations help ?

Would you agree to copy here the different from default settings necessary and sufficient to read mp4 files within TMH ?

JanGerber (talkcontribs)

if you click on the direct link in the transcode table to the mp4 can you play that in your browser? mp4 might only show up if you dont support any of the other encodings. i.e. in Safari.

JanGerber (talkcontribs)
Dieudo (talkcontribs)

Great !

It works now also on Safari and on iPad : )

But strangely on Firefox it still doesn't show the mp4 or h.264 in the list of available formats.

Never mind, the most important is that it works in at least one format (actually webm and ogv).

THANK YOU !

Jack Stenner (talkcontribs)

THANK YOU! Wish I'd found this hours ago, but I guess I'm more familiar with the extension code than I would have been otherwise, LOL. FWIW, this change is still not rolled into the latest snapshot (currently): version 729afbe of the TimedMediaHandler extension for MediaWiki REL1_21

Alex Mashin (talkcontribs)

Looks like this recipe is outdated. Do you know, by any chance, how to force transcoding of existing files to the formats newly added to $wgEnabledTranscodeSet? As of now, Transcoding Status shows only the formats that were set up when the file in question was uploaded. cleanupTranscodes.php only removes transcoded files that are no longer needed.

Reply to "How to enable transcoding to H.264 ?"