automated download, encode, upload to megaupload.com

Topics on common programming languages
Post Reply
Mysoogal
Captain
Captain
Posts: 223
Joined: Thu Dec 17, 2009 7:15 am
Location: Planet VPS

automated download, encode, upload to megaupload.com

Post by Mysoogal » Fri Sep 17, 2010 11:56 pm

this is my automated download, encode , upload to megaupload.com script written in Linux mint gedit :D

to use it you need to install plowshare, and have access to terminal , replace user:pass with your megaupload login information.

you would just need to input the remote url into wget and add the name of the file under

if the remote url is http://amd.co.at:8083/AFV_-_slide1.wmv
the filename would be like this
ffmpeg="AFV_-_slide1.wmv"
loop="AFV_-_slide1.mp4"

then you chmod a+ rpps.sh and t run ./rpps.sh in terminal, it will start the download and encoding process :mrgreen: when compeleted you get your megaupload Link and you can also find the uploaded file in your megaupload account under files.

thats it i'm still working on adding ftp support and maybe integrate this into php

updated,

will also upload theora clips to megaupload :mrgreen:

Code: Select all

#!/bin/bash
# Remote Download - Encoded to MP4 & Theora - automated Upload to Megaupload.com
# automated logic, mysoogals
# linux dependency ubuntu 8.10 - 10.04 - linux mint 9- http://code.google.com/p/plowshare/ 
# build qt-faststart - ffmpeg - http://ubuntuforums.org/showthread.php?t=786095


wget="http://amd.co.at:8083/AFV_-_slide1.wmv"
ffmpeg="AFV_-_slide1.wmv"
loop="AFV_-_slide1.mp4"
ffmpegout="$loop"
qtinput="$loop"
qtout="$loop"
 
wget $wget && ffmpeg -i $ffmpeg -acodec libfaac -ab 128k -ac 2 -vcodec libx264 -vpre slow -crf 22 -threads 0 $ffmpegout && qt-faststart $ffmpegout $ffmpegout.qt.mp4 && plowup -a user:pass -d "$ffmpegout.qt.mp4" $ffmpegout.qt.mp4 megaupload && rm $ffmpeg && rm $ffmpegout && chmod 777 $ffmpegout.qt.mp4 && ffmpeg2theora $ffmpegout.qt.mp4 $ffmpegout.qt.ogv && chmod 777 $ffmpegout.qt.ogv && plowup -a user:pass -d "$ffmpegout.qt.ogv" $ffmpegout.qt.ogv megaupload
User avatar
Saman
Lieutenant Colonel
Lieutenant Colonel
Posts: 828
Joined: Fri Jul 31, 2009 10:32 pm
Location: Mount Lavinia

Re: automated download, encode, upload to megaupload.com

Post by Saman » Sat Sep 18, 2010 2:47 am

Very useful bro. Thanks for sharing.
Mysoogal
Captain
Captain
Posts: 223
Joined: Thu Dec 17, 2009 7:15 am
Location: Planet VPS

Re: automated download, encode, upload to megaupload.com

Post by Mysoogal » Sat Sep 18, 2010 5:23 am

Saman wrote:Very useful bro. Thanks for sharing.
this is just to download and encode video , and move to /var/www/uploads this is from my video script encoder engine :mrgreen:

Code: Select all

#!/bin/bash
# Remote Download - Encoded to MP4 
# automated logic, mysoogals
# linux dependency ubuntu 8.10 - 10.04 - linux mint 9 -
# build qt-faststart -&- ffmpeg - http://ubuntuforums.org/showthread.php?t=786095


wget="http://cutiespankee2.kir.jp/wmv/cm_ant_g.wmv"
ffmpeg="cm_ant_g.wmv"
loop="cm_ant_g.mp4"
ffmpegout="$loop"
qtinput="$loop"
qtout="$loop"
 
wget $wget && ffmpeg -i $ffmpeg -acodec libfaac -ab 128k -ac 2 -vcodec libx264 -vpre slow -crf 22 -threads 0 $ffmpegout && qt-faststart $ffmpegout $ffmpegout.qt.mp4 && rm $ffmpeg && rm $ffmpegout && chmod 777 $ffmpegout.qt.mp4 && mv $ffmpegout.qt.mp4 /var/www/uploads/
User avatar
Saman
Lieutenant Colonel
Lieutenant Colonel
Posts: 828
Joined: Fri Jul 31, 2009 10:32 pm
Location: Mount Lavinia

Re: automated download, encode, upload to megaupload.com

Post by Saman » Sat Sep 18, 2010 5:12 pm

This is highly useful and I really appreciate your passion to share your knowledge with ROBOT.LK.

Thanks again !!!
Mysoogal
Captain
Captain
Posts: 223
Joined: Thu Dec 17, 2009 7:15 am
Location: Planet VPS

Re: automated download, encode, upload to megaupload.com

Post by Mysoogal » Sun Sep 19, 2010 12:21 am

:mrgreen: no problems i hope somebody can further expand and improve the code :D
Mysoogal
Captain
Captain
Posts: 223
Joined: Thu Dec 17, 2009 7:15 am
Location: Planet VPS

Re: automated download, encode, upload to megaupload.com

Post by Mysoogal » Tue Sep 21, 2010 10:32 pm

just figured how to add ftp uploading using cURL :mrgreen:

now you can use a cheap VPS box with root to do the downloading encoding and uploading to your remote streaming server :D

Code: Select all

    #!/bin/bash
    # Remote Download - Encoded to MP4 - FTP upload 
    # automated logic, mysoogals
    # linux dependency ubuntu 8.10 - 10.04 - linux mint 9 -
    # build qt-faststart -&- ffmpeg - http://ubuntuforums.org/showthread.php?t=786095
    # cURL install - Debian - Ubuntu - Mint Linux etc - Terminal - sudo apt-get install php4-curl

    class_wget="http://eric.stamen.com/mov/doa401.mov"
    # file extension should be same here 
    local_file="doa401.mov" #ffmpeg load file
    # rename just the file name, do not touch the .mp4
    loop_local_file="doa401.mp4" #local feeder
    Out_put_file="$loop_local_file" #feed to qt faststart 

wget $class_wget && ffmpeg -i $local_file -acodec libfaac -ab 128k -ac 2 -vcodec libx264 -vpre slow -crf 22 -threads 0 $Out_put_file && qt-faststart $Out_put_file $Out_put_file.qt.mp4 && rm $local_file && rm $Out_put_file && chmod 777 $Out_put_file.qt.mp4 && mv $Out_put_file.qt.mp4 /tmp/ && curl -T /tmp/$Out_put_file.qt.mp4 -u your_user:your_pass ftp://somesite.com/$Out_put_file.qt.mp4
to upload file to another folder, just add
ftp://somesite.com/some folder/$Out_put_file.qt.mp4
thats about it, i still need to fix some things like dynamic URL with echo which i still have not figured out
Mysoogal
Captain
Captain
Posts: 223
Joined: Thu Dec 17, 2009 7:15 am
Location: Planet VPS

Re: automated download, encode, upload to megaupload.com

Post by Mysoogal » Tue Sep 21, 2010 11:58 pm

this is to keep the terminal session active even when you terminate your terminal session, because sometimes the encoding process can take a long hour, a user might not want to keep the terminal window open !

execute the script like this in terminal, this will output nothing interesting but keep in mind everything is working, the process is still working !
nohup sh -c './script.sh'
forgot to add after you execute that command in terminal ,you can disconnect from the terminal shutdown etc and do something else :mrgreen:
User avatar
Saman
Lieutenant Colonel
Lieutenant Colonel
Posts: 828
Joined: Fri Jul 31, 2009 10:32 pm
Location: Mount Lavinia

Re: automated download, encode, upload to megaupload.com

Post by Saman » Wed Sep 22, 2010 11:03 am

Excellent. If you can put up a separate "How to keep the terminal session active even after terminate" article under Linux OS section, I think it will be great for ROBOT.LK users.
Post Reply

Return to “.Net & Other Programming”