How do I install FFMPEG in Heroku and use it? - heroku

I would like to use FFMPEG for my bot that I want to host on Heroku. For this I installed the following buildpack: https://elements.heroku.com/buildpacks/jonathanong/heroku-buildpack-ffmpeg-latest.
I added some checks in my source code to check the FFMPEG path:
source = discord.PCMVolumeTransformer(
discord.FFmpegPCMAudio(song.stream_url, executable=FFMPEG_PATH, before_options=beforeArgs),
volume=state.volume)
and the path is:
FFMPEG_PATH = parser.get('MUSIC', 'ffmpeg-path')
In a config file I then have the following:
ffmpeg-path : /usr/bin/ffmpeg
But this does not seem to be the correct path. So how do I get the path of the buildpack at Heroku?

To get the FFMPEG working on Heroku you have to install the following packs:
https://github.com/jonathanong/heroku-buildpack-ffmpeg-latest - FFMPEG.
https://github.com/xrisk/heroku-opus - Avoids OpusNotLoaded() errors.
You can add them under Settings/Buildpacks.
The default path, if needed, is ffmpeg.
You can then launch the bot.

Related

HEROKU ImageMagick not detected

I'm working on MoviePy to burn subtitles into video. Using TextClip
subData = processSrtFormatData(request.json['subData'])
subtitles = SubtitlesClip(subData, styleForText)
def styleForText(txt):
return TextClip(txt, font='Arial', fontsize=12, color='white')
and when deploy to Heroku. It throws error like in image below
IMG_URL: https://i.ibb.co/0DLMvtc/Untitled.png
I tried to use different buildpacks on Heroku, include:
https://github.com/DuckyTeam/heroku-buildpack-imagemagick
https://github.com/ello/heroku-buildpack-imagemagick
But only
https://github.com/ello/heroku-buildpack-imagemagick
works.
The problem is the 'ello' use imagemagick 6.9 and failed to work with unicode (as shown here). However on local run with imagemagick 7.1, it worked perfectly.
My question is how can I set the buildpack 7.1 on heroku or is there any other way to work with my MoviePy TextClip on unicode
IMG_URL: https://i.ibb.co/xHNmGcz/Untitledsd.png
Many thanks! (sorry for the images, dont have 10 reputation to include inside the question)

Unable to Install Facebook Duckling on Windows - Stack Exec Fails

I'm trying to setup Facebook Duckling on Windows 10.
When I execute: stack exec duckling-example-exe it produces the following error:
duckling-example-exe.EXE: /etc/zoneinfo/: getDirectoryContents:findFirstFile: does not exist (The system cannot find the path specified.)
I don't understand why I'm getting this error since I followed the recommendation on this GitHub thread which suggests replacing "/usr/share/zoneinfo/" in Duckling/exe/ExampleMain.hs with a link to a folder containing the zoneinfo files. You can see I replaced the path as suggested in the screenshot below:
I also tried adding a double slash as seen below - but it didn't help:
I tried with forward slash instead but this didn't help either:
Moreover, I don't understand where the path: /etc/zoneinfo/ is coming from, if the path is no longer present in ExampleMain.hs? Where is the compiler pulling the path from?
Thanks!
You need to run stack exec duckling-example-exe in the directory where the stack.yaml and project.yaml files of the duckling source code is that you are trying to modify. Otherwise it will use the version of duckling from stackage without your changes.

Moviepy: no audio in written videofile when running on heroku

I am making videos with moviepy. Created locally, the final videofile has audio. When I run the same code on heroku, the final video has no audio.
First, I thought not using the /tmp directory on heroku might be the issue. I also followed advice to add audio parameters to write_videofile. Both didn't solve the problem.
I am using the heroku ffmpeg buildpack.
#Make soundtrack
soundtrack = AudioFileClip('https://storage.googleapis.com/ABC/music.mp3')
soundtrack = soundtrack.set_duration(final_clip.duration)
#Add soundtrack
final_clip = final_clip.set_audio(soundtrack)
#Write videofile
final_clip.write_videofile('tmp/video/combined_movie.mp4',
codec='libx264',
audio_codec='aac',
temp_audiofile='tmp/video/soundtrack-temp-audio.m4a',
remove_temp=False,
fps=10)
#Storing on google cloud
try:
upload_blob('ABC','tmp/video/combined_movie.mp4','tmp/video/combined_movie.mp4')
except:
print('error when uploading final video file to google storage.')
In the console is see:
Moviepy - Building video tmp/video/combined_movie.mp4.
MoviePy - Writing audio in %s
MoviePy - Done.
Moviepy - Writing video tmp/video/combined_movie.mp4
Moviepy - Done !
Moviepy - video ready tmp/video/combined_movie.mp4
Google Cloud Storage upload successful.
Help is appreciated!
Found a solution!
I forked the same buildpack and changed the DOWNLOAD variable to ffmpeg version 4.1.3 (same version installed on my localhost).
Just run this command on your terminal:
heroku buildpacks:add https://github.com/merwane/heroku-buildpack-ffmpeg-latest.git

nReco.Video Converter ffMpeg Error

I am using Nreco Video Converter for take video thumbnail on my MVC project. App is working correctly on local but it shows error on live host
Error is
Access to the path 'C:\Inetpub\vhosts********\httpdocs\bin\ffmpeg.exe' is denied.
I did search this file in my code and host bin folder but I can't found. NReco's site says
Simple and easy to use video conversion .NET library: all you need is one assembly (FFMpeg is embedded)
There is no ffmpeg.exe file in local and host bin folder or anywhere.
How can i fix this?
Thanks.
VideoConverter is a .net wrapper for ffmpeg tool (I'm an author of this library) and ffmpeg.exe is extracted into app bin folder (default location) on first use. On your live host asp.net process cannot write to app bin folder; this may be fixed by specifying another location, for example:
var ffmpeg = new FFMpegConverter();
ffmpeg.FFMpegToolPath = System.Web.HttpContext.Current.Server.MapPath("~/App_Data");

Travis build with nodejs en custom ftp

I m trying to use travis CI with nodejs and I m facing a problem like this one.
What I want here, is only to use ftp to upload my file, not to run any command.
No Rakefile found (looking for: rakefile, Rakefile, rakefile.rb, Rakefile.rb)
I dont know what is the problem actually... Here's my travis.yml file :
env:
global:
- "FTP_USER=xxx"
- "FTP_PASSWORD=xxx"
after_success:
"curl --ftp-create-dirs -T uploadfilename -u $FTP_USER:$FTP_PASSWORD ftp://xxxx.fr/www/mochatest"
What am I doing wrong ?
I faced similar scenario when I decided to use Travis-CI with HTML+JS app. I finally ended up deployment from my package.json file via "posttest" section. I wrote some code which uses ftp-deploy npm module to upload the files. Test repository here.

Resources