Transcoding all uploaded videos to FLV

danneh3826
danneh3826's picture

Joined: 2007-08-18
Posts: 290
Posted: Tue, 2010-12-07 16:32

yep. i use -strict experimental on my production server using this module with no ill effects. this is why the "extra ffmpeg flags" field is there in the admin.

if i get any reports of using the experimental aac codec producing consistently bad results then i'll change it to allow libfaac or other iterations of libmp3lame, but for now, i've heard nothing and, as i mentioned, i use it also and not had any problems with it to date. ymmv.

let me know what sort of results you get.

Dan

 
sandaliero

Joined: 2010-12-06
Posts: 3
Posted: Thu, 2010-12-09 13:30

Ok, I'll modify detection function by myself.

But I have suggestion on another problem :)
Transcoding long videos takes significant time and results in freezing upload window or even shows server error.
I think possible solution is to do job asynchronously, i.e. instead of starting encoding immediately, module saves command to the queue which is processed then via periodical cron job. Maybe this could be useful in kind of option 'instant transcoding' / 'run transcoding via cron'.

 
danneh3826
danneh3826's picture

Joined: 2007-08-18
Posts: 290
Posted: Thu, 2010-12-09 19:50

if you get something that works, please do share.

this is something i've already noticed. however i've not ventured myself into the work of executing tasks using a cronjob rather than doing them there and then. i'm currently working on an amazon s3 module which has to have a crontab run task to upload the contents of g3 to s3. once i've got me a decent method for this, i'll apply the same logic to transcode so that this is also possible. this'll give more of the youtube-esq experience where you just upload the video and then the server goes off into the background and transcodes the video into the relevant formats.

Dan

 
feureau

Joined: 2010-12-27
Posts: 2
Posted: Mon, 2010-12-27 05:43

Hi, all. I can't seem to install transcode to gallery2 on dreamhost. I uploaded the entire thing to the /module folder but nothing shows up in my admin > plugins page. Any ideas? I tried logging in/out, refreshing everything under maintainance and even restarting the apache server.

Thank you for all the work on the module, danneh

 
danneh3826
danneh3826's picture

Joined: 2007-08-18
Posts: 290
Posted: Mon, 2010-12-27 13:36

this module is for gallery3 only. it won't work on gallery2. this is what you're looking for.

Dan

danneh.org :: Gallery3

 
feureau

Joined: 2010-12-27
Posts: 2
Posted: Tue, 2010-12-28 08:59

LOL :D Sorry 'bout that. My bad.

Thanks for the pointer. ^^ And the awesome module!

 
Jonreynolds

Joined: 2008-03-09
Posts: 96
Posted: Sun, 2011-01-09 22:53

Hmm, having difficulties. Something does not seem to be creating anything in g3/var/modules/transcode/

I had to manually create log to get logs to work... and logs are saying that /flv doesn't exist...should I be having to create these manually?

After creating transcode/flv and chmod 777 it, it now works...

Another question, I have only chosen 1 resize option (360p) on the movie page though, this is the ONLY option, where is the original size?

Jon Reynolds
www.jcrdevelopments.com

 
danneh3826
danneh3826's picture

Joined: 2007-08-18
Posts: 290
Posted: Mon, 2011-01-10 08:03

the original is "removed" (it's not really removed, the original is still where it should be in var/albums, but the js on the flowplayer page switches the links around in favour of the files it's created. it does this because it assumes that it's either a larger file (one of the reasons you'd be using this module in the first place, to down convert so that it's actually streamable), or that it's in a format that flowplayer may not be able to play back (one of the other reasons for using this module).

the fact that you're having to create files and folders manually suggests you have some permissions problems in g3/var somewhere. as g3 and this module run as the web server user, like the rest of gallery, check the permissions of the folders within var to see whether they're 777'd or owned by your webserver user (one of apache, web, www, www-data, etc).

Dan

danneh.org :: Gallery3

 
sandaliero

Joined: 2010-12-06
Posts: 3
Posted: Thu, 2011-01-13 16:06

Some changes in audio codec detection function to support more encoders:

--- modules/transcode/controllers/admin_transcode.php.orig      2010-11-12 01:25:16.000000000 +0300
+++ modules/transcode/controllers/admin_transcode.php   2011-01-13 18:41:55.135925541 +0300
@@ -65,7 +65,9 @@

     private function _get_supported_audio_codecs($given_path = null) {

-        $flv_compatible_codecs = array("aac" => "aac", "adpcm_swf" => "adpcm_swf", "mp3" => "libmp3lame");
+        $flv_compatible_codecs = array("aac"       => array("aac", "libfaac"),
+                                       "adpcm_swf" => array("adpcm_swf"),
+                                       "mp3"       => array("mp3", "libmp3lame"));

         if ($given_path)
             $ffmpegPath = $given_path;
@@ -85,11 +87,20 @@
         $found = array();
         foreach ($codecs as $line) {
             if ($search) {
-                if (strpos($line, "DEA")) {
+                if (strpos($line, "EA")) {
                     $bits = preg_split("/[\s]+/", $line);
-                    if (in_array($bits[2], $flv_compatible_codecs)) {
-                        $key = array_search($bits[2], $flv_compatible_codecs);
-                        $found[$key] = $flv_compatible_codecs[$key];
+                    reset($flv_compatible_codecs);
+                    while (list($codec, $encoders) = each($flv_compatible_codecs)) {
+                        while (list($priority, $encoder) = each($encoders)) {
+                            if ($bits[2] === $encoder) {
+                                if (array_key_exists($codec, $found)) {
+                                    if ($priority < array_search($found[$codec], $encoders)) {
+                                        continue;
+                                    }
+                                }
+                                $found[$codec] = $encoder;
+                            }
+                        }
                     }
                }
             }
@@ -103,6 +114,7 @@
                 continue;
             }
         }
+        $found = array_flip($found);
         return $found;
     }
 
danneh3826
danneh3826's picture

Joined: 2007-08-18
Posts: 290
Posted: Thu, 2011-01-13 20:47

thanks :)
i'll incorporate that in the next release :)

Dan

danneh.org :: Gallery3

 
cmisip

Joined: 2011-02-20
Posts: 22
Posted: Sun, 2011-02-20 21:48

I am having some problems with transcoding videos in conjunction with server add module. It seems that sometimes, I end up with multiple versions of the file I uploaded with the second and third filename having a -NNNNNNNN.flv appended to the file name where N is a series of numbers. The original file and the copies get passed on to the transcode module and so after the transcode job, they appear all in the gallery album. I did modify the transcode module by adding

if (preg_match('/(\d*) kb\/s/', $line, $bitrate))
$file->audio->bitrate = $bitrate[1];
}
}
+ if (empty($file->video->width)) {
+ $file->video->width = "1920";
+ $file->video->height = "1080";;
+ //just assume that all videos have audio for now
+ $file->audio->has = true;
+ }
return $file;

to helpers/transcode_event.php

And had to rename my source videos so they have a .flv extension (to get by Gallery 3's filename limitation) . My source videos are AVHCD.
The problem happens when I select more than 2 resolutions for transcoding.

I would appreciate any insight.
Thanks
Chris

 
cmisip

Joined: 2011-02-20
Posts: 22
Posted: Sat, 2011-03-12 13:45

I think the issue is with latency introduced by the transcode module at the same time that a large file is being uploaded. At any rate, it is not a transcode issue.

I have posted a patch for transcode that adds mp4 creation and a few other features that is iphone friendly in this new thread.

http://gallery.menalto.com/node/101222

Thanks for creating this module.

Chris

 
hariseta@gmail.com

Joined: 2011-06-27
Posts: 1
Posted: Mon, 2011-06-27 19:35

Hello,

I have installed transcode10.zip in G3 on a hosted server. I also manually installed ffmpeg 0.6 in my directory and set rights to 755.
When I try to configure transcode settings and set the ffmpeg path to ../../ffmpeg (this is the path i put in the Admin advanced settings), it fails.

I put the ffmpeg path, then click to verify ffmpeg path and it shows "Empty file path provided".

Not sure what I am doing wrong.

Thanks for the great work on the module.

Laurent

 
danneh3826
danneh3826's picture

Joined: 2007-08-18
Posts: 290
Posted: Tue, 2011-07-05 12:20

i'm contemplating doing a hosting version of this. basically, the idea would be is that, when you upload your video to g3 (g3 on your server, not mine), transcode will kick in and upload it to one of my servers, where i'd do the encoding instead of you. i'd then store the resulting files on something like amazon s3. once transcoding is complete, my servers would contact your g3 installation with the transcoding results and url's to each flavour, which the transcode module would use to give to flowplayer. optionally i guess transcode could also download them all once they're done if you want to host the videos yourself but don't want to deal with the transcoding part of things.

there'd be a small monthly fee or something, since hosting and disk space/bandwidth aren't cheap. i don't know what they'd be yet, but if this was an option and at a good affordable price, is this something that people would want? i suppose the advantages to this are that you don't have to be concerned about having ffmpeg setup on your server, and i can tune my servers all the time to enhance the results and add in new formats. i suppose i could do pricing tiers, such as;

1. transcoding only - transcodes the videos and sends you the urls to the end results. urls expire after 24 hours and files end up being deleted after this time elapses;
2. transcode & host - as above, but urls remain active. you can download if you wish as a backup purpose.

thoughts?

Dan

danneh.org :: Gallery3

 
fenio

Joined: 2011-03-01
Posts: 9
Posted: Tue, 2011-09-20 10:49

Is someone using this module on Debian?
I start thinking ffmpeg bundled with Debian isn't comptatible with this modules.

I have nothing in logs of G3, nothing in logs of transcode module... it simply doesn't work for me :/

regards
fEnIo

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Sun, 2012-09-16 01:56