I have a linux server, I am looking to convert a .wma file to .flac file 16k
Is there a way I can do this using a PHP Script to control the server?
I was thinking .wma to .wav then .flac would be easier, but not sure how...
Any help is greately appreciated.
You can invoke the command line through PHP so that it just works as a safe interface to remote users.
Keeping that in mind you can use the ffmpeg library to go right from .wma to .flac using:
ffmpeg -i sample.wma -acodec flac -aq 100 sample.flac
You'll want to have something to manage file names and getting/serving the files, etc but that doesn't seem to be the hurdle in this case.
Related
After moving some mp4 from computer to USB stick, I discovered that my mp4 are corrupted. I guess USB stick is guilty.
However I would like to recover those MP4 files and I tried ffmpeg but without any success.
As I work under Linux, I tried:
ffmpeg -i corrupted_video_file.mp4 -c copy fixed_video_file.mp4
Is there another way to fix corrupted mp4 files or any other tool ?
thx
I am trying to compress an audio file and I use -y command to overwrite the existing file. But problem is that that command decreases the duration of the audio file.
I am using the following command:
ffmpeg -y -i D:\audio\Blues.mp3 -ab 64 D:\audio\Blues.mp3
Is there any way to resolve this within ffmpeg? Thanks.
You can't read from a file and write to it at the same time with FFmpeg.
Write to a different file, then delete the original afterwards.
I created a nodejs application hosted on heroku which uses imagemagick. I am doing this operation:
require('child_process').exec(`convert -quiet -delay 1 output.avi ${gif}`);
This should convert output.avi (which is present) to a gif file. In this case, gif is "/app/temp/gifs/xstrycatdq.gif". This command works perfectly on my local windows machine. As I use the path module to get a variable with path.joinand __dirname.
I have installed heroku buildpack:
https://github.com/ello/heroku-buildpack-imagemagick
The error I am receiving is:
Command failed: convert -quiet -delay 1 output.avi /app/temp/gifs/xstrycatdq.gif
convert: DelegateFailed `'ffmpeg' -nostdin -v -1 -vframes %S -i '%i' -vcodec pam -an -f rawvideo -y '%u.pam' 2> '%Z'' # error/delegate.c/InvokeDelegate/1919.
convert: UnableToOpenBlob `magick-93R4VJcemPz0z1.pam': No such file or directory # error/blob.c/OpenBlob/2705.
convert: NoImagesDefined `/app/temp/gifs/xstrycatdq.gif' # error/convert.c/ConvertImageCommand/3257.
It seems that the /tmp/ directory can't be written to or anything. I also tried to mkdir /tmp/ but bash tells me that this dir already exists.
I have also tried changing the imagemagick's temp directory with the environment variable by doing export MAGICK_TMPDIR="temp".
Any help?
Edit: The variables are now absolute.
Are you sure it's not an issue of permissions? Can you write a simple text file to /app/temp? Is nothing is being read or written at all, it sounds like an issue of permissions. Maybe it's not necessarily a protection design of ImageMagick, but rather heroku or your programming environment?
This directory you're trying to use, it's special in that it contains corrupt or incomplete files - it may have special protections or guards in place, when certain software is running. temp directories are typically designed (or assumed) to be protected from user interference, as they are only to be used and worked with, by the program itself - not the user's commands of the program.
This question is similar to yours, it might be able to help you.
I'm in the process of attempting to convert all my WAV files to FLAC files in such a way that my music directory for FLACs is identical to my music directory for WAVs.
At the moment I have my music archive set up, such that a typical album is here:
/directory1/directory2/directory3/Music/WAV/Artist/Album
So I would like a one-to-one correspondance for my FLAC files that looks as follows:
/directory1/directory2/directory3/Music/FLAC/Artist/Album.
I know that I will have to use find to list all the directories/subdirectories as follows:
find -type d -exec commands.sh
But how do I write the commands.sh file such that it will grab the Artist/Album part of the path in the WAV directory, mkdir the same /Artist/Album in the FLAC directory, and then output the flacs to the FLAC/Artist/Album directory?
I know the command for converting flacs to an output directory of your choice is:
flac -5 --out-prefix="/desired/output/path" *.wav
So I guess I'm just having trouble with grabbing/recreating the file paths!
This would be a whole lot easier in a scripting language like ruby, perl or python. Something like this is a fairly straightforward starter project in any of those languages. There are libraries for find and path manipulation that make this
all pretty easy.
However, there are two posix utilities that can help with splitting apart pathnames. dirname and basename. I think those two and sed should let you do
what you want.
Find will always return relative paths and any exec occurs in the directory of the target by default, if this is not what you want look in the man pages. You can force find to stay in the top level directory.
I have a file that is compressed and I want to decompress it.
Do you know if there is a command or do I need to follow another path?
There isn't one built into FORTRAN 77, but you can shell out to the UNIX commands
gzip, gunzip to compress/decompress a file (assuming you are running on UNIX).
Does this help you?