I've got the following setup:
* Media
* Media derivatives with UI enabled
* Media ffmpeg simple

I can't get my files converted and always get this error:

    Notice: Undefined property: stdClass::$media_derivatives in media_derivatives_create_derivative_object() (line 353 of /home/lexor/www/va/sources/sites/all/modules/contrib/media_derivatives/media_derivatives.module).
    PDOException: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'uri' at row 1: INSERT INTO {file_managed} (uid, filename, uri, filemime, filesize, status, timestamp, type, uuid) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8); Array ( [:db_insert_placeholder_0] => 1 [:db_insert_placeholder_1] => github-network-bug-convert-convert-convert-convert-convert-convert-convert-convert-convert-convert-convert-convert-convert-convert-convert-convert-convert-convert-convert-convert-convert-convert-convert-convert-convert-convert-convert-convert-convert.flv [:db_insert_placeholder_2] => public://github-network-bug-convert-convert-convert-convert-convert-convert-convert-convert-convert-convert-convert-convert-convert-convert-convert-convert-convert-convert-convert-convert-convert-convert-convert-convert-convert-convert-convert-convert-convert.flv [:db_insert_placeholder_3] => video/x-flv [:db_insert_placeholder_4] => 1156804 [:db_insert_placeholder_5] => 1 [:db_insert_placeholder_6] => 1331655104 [:db_insert_placeholder_7] => video [:db_insert_placeholder_8] => 4929e0c2-f6d4-d344-d977-3348e729e268 ) in drupal_write_record() (line 6975 of /home/lexor/www/va/sources/includes/common.inc).

As you can see this is an attempt to insert a very long filename that fails. Why it is so long you may wonder? Deeper code analysis gives the answer - there is a recursive call because of media_derivatives_entity_presave hook, that generates file saves, that call media_derivatives_entity_presave again (hey, file is also an entity!).

I really wonder how on Earth you were able to get it working for a demo?

Comments

slashrsm’s picture

You must use "Encode derivatives" condition and leave it's checkbox unchecked. This will prevent just created derivative from beeing encoded again.

I think I mentioned this in the screencast. Please let me know if this fixes your problem.

lex0r’s picture

Category: bug » feature
Priority: Critical » Major

Thanks for the help, I just missed the screencast and couldn't figure out what was happening.
Great module, btw! That's something we really need when working with media - create derivatives.

Anyway, the way we configure presets now is confusing, I mean the "derivative of derivatives" option. I think user doesn't
have to think about any side effects that may appear because of not checked option. He/she should be able
to create presets without watching the screencast or reading documentation (I did in this way and everything was clear enough except for this "derivative of derivatives" option). So, this issue is about better UX, I change it to "feature request".

I guess making this option as default one (99% of users will just need to convert one file into another, and nothing more) will improve the UX.