Title: Requirement automatic encoding on upload
Last modified: August 30, 2016

---

# Requirement automatic encoding on upload

 *  Resolved [benhartwich](https://wordpress.org/support/users/yoursql719/)
 * (@yoursql719)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/requirement-automatic-encoding-on-upload/)
 * Hi,
 * I puzzle over frontend publishing and video upload is working and the file is
   placed at the media library like all other files, but the video files are not
   encoded automatically after upload. If I upload the file normally at the wordpress
   media uploader the automatic encoding works – so it´s plugin issue.
 * To tell the developer, what they should implement I need to know the requirements
   on encoding uploaded videos at the media library. Is there a specific post (attachment)
   meta or something else, which has to be set in order to start automatic encoding?
   Would be great if you could write me a few lines how this encoding is processed.
 * Automatic Thumbnail creation is working.
 * Regards,
 * Ben
 * [https://wordpress.org/plugins/video-embed-thumbnail-generator/](https://wordpress.org/plugins/video-embed-thumbnail-generator/)

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Plugin Author [Kyle Gilman](https://wordpress.org/support/users/kylegilman/)
 * (@kylegilman)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/requirement-automatic-encoding-on-upload/#post-6603229)
 * There’s no metadata involved. Automatic encoding is triggered by the `add_attachment`
   action.
 *  Thread Starter [benhartwich](https://wordpress.org/support/users/yoursql719/)
 * (@yoursql719)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/requirement-automatic-encoding-on-upload/#post-6603248)
 * Thank you! I´ve uploaded the video with different post metas from frontend, but
   it´s not automatically encoded. Is it possible to define a post meta, which triggers
   die encoding or any other option?
 *  Plugin Author [Kyle Gilman](https://wordpress.org/support/users/kylegilman/)
 * (@kylegilman)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/requirement-automatic-encoding-on-upload/#post-6603250)
 * There is no post meta to trigger encoding. The encoding should start when the`
   add_attachment` action is triggered. It’s almost impossible for your frontend
   uploader plugin to skip this step, so there’s some other reason why encoding 
   doesn’t start. Especially if thumbnails are generated automatically but encoding
   doesn’t start. Both automatic events are part of the same function. Is this a
   freely available frontend publishing plugin? It’s very difficult for me to just
   guess at what could be causing this problem.
 *  Thread Starter [benhartwich](https://wordpress.org/support/users/yoursql719/)
 * (@yoursql719)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/requirement-automatic-encoding-on-upload/#post-6603251)
 * No, it´s a premium plugin, but I could send it to you, if you would like to. 
   I need to know, what I can tell the plugin support, but it could be that the 
   problem is at your plugin – don´t know, how to test / figure it out.
 *  Thread Starter [benhartwich](https://wordpress.org/support/users/yoursql719/)
 * (@yoursql719)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/requirement-automatic-encoding-on-upload/#post-6603305)
 * Hi,
 * I´ve got updates. Problem is that the encoding path is build wrong, because it
   mixes the server path with the attachment media url for encoding. That´s because
   the frontend uploader uses a specific post meta, which upload the file as attachment,
   but add an url string for the post meta and it seems that your plugin recognizes
   these url first at media section although the media file looks like all others
   and thumbnail is generated automatically. It seems that your plugin grabs the
   file at the wrong position.
 * Is there a possibility to use if clauses or cases for getting a working file 
   path, if the encoder recognizes a http? Now the path for your plugin looks like:
   `/
   var/www/localhost/htdocs/wordpress/wp-content/uploads/http://xy.de/wordpress/
   wp-content/uploads/2015/10/prism-is-a-dancer-life-of-sven-iphoneswelcome-neo-
   magazin-royale-mit-jan-bohmermann-zdfneo.mp4: No such file or directory`
 * Regards,
 *  Plugin Author [Kyle Gilman](https://wordpress.org/support/users/kylegilman/)
 * (@kylegilman)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/requirement-automatic-encoding-on-upload/#post-6603307)
 * For encoding purposes, my plugin gets the video path using the WordPress function
   [`get_attached_file()`](https://developer.wordpress.org/reference/functions/get_attached_file/).
   That function reads the value of the post meta entry `_wp_attached_file`, which
   it expects to be something like ‘/2015/10/videofile.mp4’ and combines it with
   the file path to the uploads directory. `_wp_attached_file` is a relative path
   because it’s also used for functions like [`wp_get_attachment_url()`](https://developer.wordpress.org/reference/functions/wp_get_attachment_url/),
   which adds the URL to the uploads directory to the value of `_wp_attached_file`.
   If for some reason the frontend uploader is saving a complete URL instead of 
   the relative path in `_wp_attached_file`, then I would ask why the frontend uploader
   is doing that.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Requirement automatic encoding on upload’ is closed to new replies.

 * ![](https://ps.w.org/video-embed-thumbnail-generator/assets/icon.svg?rev=2965979)
 * [Videopack](https://wordpress.org/plugins/video-embed-thumbnail-generator/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/video-embed-thumbnail-generator/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/video-embed-thumbnail-generator/)
 * [Active Topics](https://wordpress.org/support/plugin/video-embed-thumbnail-generator/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/video-embed-thumbnail-generator/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/video-embed-thumbnail-generator/reviews/)

 * 6 replies
 * 2 participants
 * Last reply from: [Kyle Gilman](https://wordpress.org/support/users/kylegilman/)
 * Last activity: [10 years, 7 months ago](https://wordpress.org/support/topic/requirement-automatic-encoding-on-upload/#post-6603307)
 * Status: resolved