Not Solved [How To?] gif to webm or mp4
#1
Not Solved
Is there a way to change gif to webm or mp4 when uploading in attachment.php?

I am looking for a way to reduce server image storage space.
Reply
#2
Not Solved
(2018-08-24, 03:07 PM)alstn13178 Wrote: Is there a way to change gif to webm or mp4 when uploading in attachment.php?

I am looking for a way to reduce server image storage space.

Use an excellent outside image hosting website.

Look at Imgur
I'm Serpius and You're Not    ¯\_(ツ)_/¯
DEAF GOLF
Reply
#3
Not Solved
Changing the file extension on a file upon uploading may render the file useless. Remember, a file extension is theoretically just a "label". You can change the label on something but that doesn't alter the product or thing you're attempting to change.

If you want mp4 files and other various formats with smaller sizes it's probably best to force it on your users in ACP > Configuration > Attachment types. Additionally, as suggested above use an external image host.
Plugin Count: I lost count.
Public Plugins are available here.
Please do not PM me for support unless asked to.
Reply
#4
Not Solved
upload.attachemnt.php

function upload_attachment($attachment, $update_attachment=false)

.
.
.

//when gif file 

$filename = "post_".$mybb->user['uid']."_".TIME_NOW."_".md5(random_str()).".attach";
$filename = preg_replace('"\.attach$"', '.mp4', $filename);	
	
	
$ffmpeg = "/usr/bin/ffmpeg";
$gifFile = $attachment['tmp_name'];
		

$output = $mybb->settings['uploadspath']."/".$month_dir."/".$filename;

$cmd = "$ffmpeg -i $gifFile -movflags faststart -pix_fmt yuv420p -vf \"scale=trunc(iw/2)*2:trunc(ih/2)*2\" $output";	
exec($cmd);   
$attachment['name'] = $output;
.
.
.
function upload_file($file, $path, $filename="")
{
.
.
//$moved = @move_uploaded_file($file['tmp_name'], $path."/".$filename);
.
.
}


ffmpeg works.

make 7M gif file to 300KB mp4 file.

*I am using imgur, but I want to upload file directly to my server.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)