Media mover is transcoding files from node attachments into flv but not submitting them to filefiled. Similar configuration for image thumbnails works OK. Any idea of reason ?

Im attaching exports of my media mover configurations, example node and content type

Comments

szczym’s picture

Title: Files transoded but not added to filefiled » Files transoded but not added fo filefiled
Category: bug » support
Priority: Critical » Normal
Issue tags: -media mover, -cck filefield

i just recreated that bug on other, plain drupal instalation.

if its need i can supply ssh access to that sandbox

trofimchouk’s picture

Try to test your FFMpeg-Wrapper module:
- go to admin/settings/ffmpeg_wrapper/test
- place some file into test direcotry
- refresh page
- choose 'use' in file list
- choose output format
- transcode

In my case there was an error while audio transcoding from avi to flv. I checked 'use advanced settings' and set sample rate to 44 (there was an ffmpeg error about audio sample rate). And now it works!

szczym’s picture

Category: support » bug

ffmpeg works, actually any setup works fine when i make it first.

Problem is: any media mover config, that was made after the first one is not submitting results into cck filefiled (but processing works, its in logs and files are made ok).

szczym’s picture

Priority: Normal » Critical
Issue tags: +media mover, +cck filefield

the issue is similar (but not identical) to #368956: Error saving to filefield in cron

Im changing it to critical, as its serous stopper for many websites.

szczym’s picture

Title: Files transoded but not added fo filefiled » Files transoded but not added to filefiled
jzornig’s picture

I have the same issue. I have two MM configs. One creates a thumb, the other transcodes the video. Both place the created files into CCK filefields. If only one config is enabled, it works. Either thumb or transcode succeeds. If both are enabled I only get the thumb attached. The transcoded video is created but not added to the CCK field.

venkiparam’s picture

Any updates, I am having the same issue, Transcoded files are not getting saved to cck filefield.

venkiparam’s picture

Ok, I took some time to probe through the code and found a spot where i think the problem is.

Its in the mm_cck.module on line number 57 - 59 in function mm_cck_media_mover, source looks like this

case 'complete':
case 'storage':
return mm_cck_node_save($action, $configuration, $file);

The problem is whenever you run a configuration, the function called for storage & complete (verbs) is the same. The problem occurs because the " storage " routine properly stores the data in the cck filefield but the " complete " routine overwrites the previous entry and hence the filefield association is completely lost.

To get a successful result (That is, the converted file gets properly attached to the cck field), try setting " bypass this operation " in the complete step or use some other operation other than the cck provided one and all works well.

Hope i am sufficiently clear for the maintainer to understand.Pardon me, this is the first time i have probed a drupal module and may be my language is not proper too.

Venkiparam

szczym’s picture

venkiparam: im having in 2 configs the "complete" set on "Media Mover defaults: Bypass this operation" and its still not adding icons into cck, plus its running the configs any time i run cron...

:/

could you post your working configs ?

venkiparam’s picture

StatusFileSize
new2.24 KB

Attached an export of the working config file. This config does nothing more than Transcoding the input file using ffmpeg and attaching it to cck field. And for the Cron issue, Make sure u have unchecked the option "Run Media Mover on cron runs" under the "Run Control" section on the settings screen (admin/build/media_mover/settings).

szczym’s picture

The issue concerns 2 mm configs: for example first for encoding and second for generating thumbnails. Problem is one of mm configs is not adding effects into the cck file filed.

The "Run Media Mover on cron runs" setting is essential for any production site.

venkiparam’s picture

StatusFileSize
new1.83 KB
new2.31 KB
new15.22 KB

Hi you were right, This is happening to me too. But i feel this is very similar #8 which i have posted above, but the issue is not with using "mm_cck_node_save()" for both storage & complete. The issue is with the mm_cck_node_save() function itself.

If you go down the call hirearchy, The function " mm_cck_field_filefield() " gets called when the field type is filefield. I tried putting a debug statement just before node_save($node) inside " mm_cck_field_filefield() " and found few interesting thing. I have attached the output to this reply. For clarity purpose, I have also attached the two configurations i used for this test.

My Observations.

The debug text has two blocks of output seprated by "------------------" . The first block is the output when the Transcoding configuration is run and the second block is the output when the thumbnail configuration is run.

It is clear that at the Transcoding phase the thumbnail array is empty, which is ok

[field_mm_thumb_file] => Array
(
[0] =>
)

But at the thumbnail generation phase the transcoded file array is empty which is not desirable.

[field_mm_result_file] => Array
(
[0] =>
)

This is the reason why the transcoded file is not shown at the node view page. Can any one post a solution to this

mani.atico’s picture

subscribing

zaczek’s picture

Title: Files transoded but not added fo filefiled » Files transoded but not added to filefiled
Category: support » bug
Priority: Normal » Critical
Issue tags: +media mover, +cck filefield

Hi,

I think I might have found a solution: http://drupal.org/node/368956#comment-1935600

Could you please test it on your site? It worked for Szczym's site.

Cheers,
Jakub Gawlikowski

zaczek’s picture

This issue is related with a change made in the CCK module: http://drupal.org/node/227677

The fix reverts to the default behaviour (not setting NULLs on fields that are not provided).

Jakub

zaczek’s picture

StatusFileSize
new614 bytes

Here is a patch for this problem meant for the CCK module (content.module).

It is meant for CCK-6.x-2.5.

It only works on non-multiple fields (i.e. if the number of values for the destination filefield to be used is set to 1 in the field definition for your content type).

Please let me know if you encounter any issues. Maybe somebody knows if it's possible to fix it in the Media Mover module?

Cheers,
Jakub

szczym’s picture

Status: Active » Reviewed & tested by the community

I confirm, the patch solves the problem!

We still need permanent solution (and we dont know if it brakes any other functions cck module)

venkiparam’s picture

I have not applied the patch yet, But i believe that what Damien Tournoud says here http://drupal.org/node/227677#comment-1937658 is true. CCK is inserting NULL into the columns because we are passing NULL (see #12 debug.txt). We need to find a solution inside Media mover.

zaczek’s picture

StatusFileSize
new5.38 KB

OK, I have looked into this again and found a way to update the Media Mover API with no changes necessary in CCK.

The problem was related with the node_load function that can only load data from core tables. This was causing the Media_Mover module to update the record with NULL data it got trying to query the nodes.

The solution is was to use the content_node_load function written by alonpeer and described here: http://drupal.org/node/360541

This function is able to load the full node including CCK fields. I have added this function to the Media Mover API, as it might be useful in other situations.

So now, instead of using node_load($nid); we are using content_node_load(array('nid' => $nid));

The new patch for media_mover_api.module is attached. It also handles the situation for multiple fields.

Cheers,
Jakub

zaczek’s picture

StatusFileSize
new4.88 KB

In this patch version, I have made a small change to follow naming conventions and changed the function name to media_mover_content_node_load.

szczym’s picture

new patch works :))) I just tested it, could any one test it also ?

cheers !

venkiparam’s picture

Confirming, The new patch works for me , Thanks to zaczek

venkiparam’s picture

The patch also works in the Dev version (Release Jul 19 2009).

zaczek’s picture

StatusFileSize
new4.87 KB

Thanks, Venkiparam.

For everyone else, the patch in question is attached here.

bekasu’s picture

Title: Files transoded but not added to filefiled » Files transcoded but not added to filefiled

Corrected misspelling in title per szczym's request

szczym’s picture

Im not sure if its directly related but that issue have #532170: MM is encoding a file any time i run config arise right now. (don`t if it was before because its happening only with more than one configuration).

arthurf’s picture

Thanks for finding this issue. Reviewing this patch, I see a few things:
* it has to conditionally load CCK- if(module_exists('content') ) if it goes into the media_mover_api module- otherwise it should live in mm_cck which depends on CCK anyway. I like the idea of having this as a core function in media_mover_api, but I'm not sure that there are any use cases beyond CCK? Not sure.
* is there a need to rewrite all of this code an not just use cck's content_load($node) function instead? If we do something like:

<?php
  $node = node_load($nid);
  content_load($node);
?>

Doesn't that give us all the same information and make the function less brittle?

I'd be happy to commit this, I just would like some feed back on the above first.

zaczek’s picture

Hi Arthurf,

I have tested this code:

$node = node_load($nid);
content_load($node);
return $node;

and it seems to work. It is cleaner for sure. You are probably right that there are no use cases beyond CCK, however I don't know how to integrate it with the mm_cck module.

Best,
Jakub

arthurf’s picture

Version: 6.x-1.0-beta2 » 6.x-1.x-dev
Status: Reviewed & tested by the community » Needs review

Thanks for testing. I committed this code to CVS last night, so I think we should be reading for testing. I did some additional refactoring to make the code cleaner. Would people mind testing this and I'll ready a new release if it passes? There are a bunch of bug fixes that would be nice to get out in the world since I've been slacking so much this summer.

szczym’s picture

arthurf its great to have you back in moving media space ! We have all ready developed patched mm, witch consisted of over 5 various patch as far as i remember ;)

I would test the cvs code strait on but here: http://drupal.org/project/cvs/106431 i can`t see any commits regarding to #486206: Files transcoded but not added to filefiled. Am i missing some thing ?

arthurf’s picture

Hrm, maybe I attributed these to a different ticket- see:
http://drupal.org/cvs?commit=261334
http://drupal.org/cvs?commit=263064

So these fixes should be in the dev branch now...

szczym’s picture

Status: Needs review » Needs work

i just tested on fresh drupal install with mm-dev from 2009-Sep-17:

the issue still exist, i have 3 mm configs, effect of one of them is not attached to cck filefiled with configs on auto run. when i make configs run manually by pressing one by one, its working ok.

the issue also exit when i swap mm_cck.module for old version patched against old "summer" version of mm-dev

arthurf’s picture

@szczym are you saying that the configuration is not running on cron, or that the fix for the filefield issue does not work?

szczym’s picture

Configs are running on node creation, file is encoded, after it its on hd and in the mm log BUT not in filefiled.

btw: i have 3 configs, 2 of them are running ok, one not makes into filefiled.
btw2: im on irc

arthurf’s picture

Are there any errors being reported by mm_cck in dblog?

szczym’s picture

no, all is normal, no errors. here is log entry from ffmpeg:

MM FFmpeg converted this file: sites/default/files/media_mover/ffmpeg/converted/1/output_1.flv
ffmpeg ran this command:
-i 'sites/default/files/output_1.avi' -acodec mp3 -ar 22050 -ab 64k -vcodec flv -b 250k -r 25 'sites/default/files/media_mover/ffmpeg/converted/1/output_1.flv'

But output_1.flv did not landed in filefiled.

okeedoak’s picture

subscribing

szczym’s picture

@arthur: what is a problem to commit zaczek patch into dev version ? as far as i see, its not in cvs but its critical for normal usage of mm ...

arthurf’s picture

The patch: http://drupal.org/files/issues/media_mover_api-nullupdate-0.3-dev.patch is in mm_cck. I don't want to use the function that is proposed as it is an attempt to duplicate content_load() which is a API function for cck- a much more stable way to do this. Can you test against 6.1.x and let me know if that is working for you?

brunodbo’s picture

I tested 6.x-dev and found that storing to filefield only works when there's no complete action (as reported in #8). Furthermore, when I display the file as 'Generic files' (set in CCK 'Display fields' settings), the link is constructed with a '?q=' in front, thus pointing to a non-existing location. When I change the Display field setting to 'URL to file', the correct URL is being displayed.

brunodbo’s picture

While transcoded files are added to the right filefield (given there's no complete action), they are not shown in the 'Media Mover files' section on node/edit (= the list where Media Mover files on that node should be displayed).

arthurf’s picture

Status: Needs work » Active

@brunodbo - can you confirm that this file is not in an error state? You can check by going to the admin -> build -> media_mover -> your configuration -> files

delykj’s picture

I tried the latest Media Mover dev version (2009. nov. 14.), with latest CCK, File Field modules and file field saving not works.
I also tried zaczek patch (http://drupal.org/node/486206#comment-1946978) but still not works.

Any idea how to save a successfully processed file into a file field?

brunodbo’s picture

@arthurf: No, no error state. Thanks for following up.

delykj’s picture

I debugged the code and fixed the bug.

In the mm_cck_field_filefield function, please change

from:

  // Add the file on to the node
 $node->{$field['field_name']}[] = $new_file;
 

to:

  // Add the file on to the node
  if ($node->{$field['field_name']}[0] == null) {
    $node->{$field['field_name']}[0] = $new_file;
  } else
    $node->{$field['field_name']}[] = $new_file;
  

When I create a new node, and the filefield is empty, the first field in the array is null. So at the cron run when you add the newly created field to the field array, Drupal not saves the new field because of the first null value.

arthurf’s picture

Status: Active » Needs review

@delykj - I've committed a variation of your code suggestion. This issue was discussed on another issue- the original code used $node->{$field['field_name']}[0] which was changed to $node->{$field['field_name']}[] due to another bug report. Hopefully your suggestion fixes it in both instances.

delykj’s picture

arthurf, your modification not works for me.
$node->{$field['field_name']} is an array, so not need to check it (at least in my case). But the first element is null.
I modified your code a little bit:

  // Do any files already exist on this node?
  if (! is_array($node->{$field['field_name']})) {
    $node->{$field['field_name']} = array($new_file);
  }
  elseif ($node->{$field['field_name']}[0] == null)  {
    $node->{$field['field_name']}[0] = $new_file;
  }
  else {
        $node->{$field['field_name']}[] = $new_file;
  } 
venkiparam’s picture

The problem as mentioned in #12 is still there. Tested against both the Latest Dev and 6.x-1.0-beta6 versions. This time the CCK field Arrays are getting populated properly but when node_save($node) is called. The CCK data is not getting saved.

rexsham’s picture

I confirm that I repeat the same problem with Latest Dev Jan-11 and 6.x-1.0-beta6 .
When first Media mover config is run, MM CCK worked ok, but when second runs, it always fail to write into the filefield, but the process is done correctly.

I transcode a flv, then make a thumbnail, both processes give correct files but only one of them can write to CCK filefield.

I have not patched anything and just used to latest release of all modules.
I'll try patching as above and reply here again.

rexsham’s picture

Issue tags: +CCK, +error, +FileField, +thumbnail
StatusFileSize
new65.04 KB
new130.6 KB
new88.36 KB
new167.12 KB

I applied the patch in #24 but it does not work for me too.
I used CCK 6.x-2.6 and 6.x-1.x-dev (2010-Jan-11)
Both Video and Thumbnail are transcoded and created, but only Video is put into filefield, Thumnail is not put into filefield.
Attached are the screenshots

arthurf’s picture

I added a modified version of #47 - can somebody who is having issues with this check out if this issue still exists?

rexsham’s picture

What modifications did you do arthurf?
I tested with 27th Jan Dev and problem still exists.
I changed the code stated in #47 but problem is still there.
Only video transcoded and put into filefield, thumbnail is created but not put into filefield.

rexsham’s picture

StatusFileSize
new120.02 KB

Problem is still there even i added your modificationin #53
Have a look at the screenshot

rexsham’s picture

Anyone got success in using this module (updating 2 CCK filefield) ?
Please post your CCK version and media mover version.
I am desperate in this

thomas4019’s picture

StatusFileSize
new3.39 KB
new3.41 KB

I seem to be having this problem. Only one of the configurations outputs is being put in the filefield.
Here's the version I am using. 6.x-1.x-dev (2010-Feb-14)

Is there a patch I can apply to fix this? Or should i revert to an earlier version. I have attached exported forms of both of my configurations.
There are no errors in the drupal log.

Thanks,

bryanb229’s picture

Anyone made any progress with this?

thomas4019’s picture

I was able to get three configurations to save transcoded videos to different FileFields in the same node when cron runs. I am using Media Mover 6.x-1.x-dev (2010-Feb-17) but i would expect the latest version to work as well. I did not have to apply any patches but i don't remember if I did anything else special to make it work.

rexsham’s picture

what version of CCK are you using?
Is it a fresh installation or what?

thomas4019’s picture

I am using
Drupal 6.15
FFmpeg Wrapper 6.x-1.1-beta1
Content Construction Kit (CCK) 6.x-2.6
FileField 6.x-3.2
Media Mover 6.x-1.x-dev (2010-Feb-17)
SWF Tools 6.x-2.5

What is your problem exactly? I am not actually using Media Mover to create transcode to FLV anymore. I am currently using Media Mover to transcode to MP4 and MPEG and am using FlashVideo (http://drupal.org/project/flashvideo) for creating the FLV files. Even if you get Media Mover to transcode to FLV, you likely will need to fix the flvs using a program like flvtool2 to make them stream well. FlashVideo will do this all for you and I have been very pleased.

hatsch’s picture

i have the same problem here. i have three configs with custom commands.
one configuration is run on node update

the other two configs run on cron. all configs show the status finished. all files are created. but one file (from the last run configuration) is not attached to cck filefield.

i am using:
Drupal 6.16
Content Construction Kit (CCK) 6.x-2.6
Media Mover 6.x-1.x-dev
FileField 6.x-3.2
Media Mover Custom Command 6.x-1.0

when i manually set the status of file that was not attached to Harvested and re-run the configuration, an error occures

recoverable fatal error: Object of class stdClass could not be converted to string in /var/www/sites/mysite/modules/token/token.module on line 238.
recoverable fatal error: Object of class stdClass could not be converted to string in /var/www/sites/mysite/modules/token/token.module on line 238.
The selected file could not be copied, because no file by that name exists. Please check that you supplied the correct filename.

and the file stops in the Processed State

i am also using filefield_paths. to assure this is not related to filefield_paths i disabled it, but i still have the same issue...

hatsch’s picture

it looks like version 6.x-1.0-beta7 eliminated the problem! at least for me
all three configs i have run now smooth on cron!
thank you!

arthurf’s picture

Status: Needs review » Closed (fixed)

Awesome. Marking this as closed unless anybody else has issues.