I'm using avconv in the following way in order to grab ID3 data from audio files on remote servers:
avconv -i http://myserver.com/my_music.mp3
This command will output all the info I need, which I then parse.
The problem is, it always exits with a non-zero exit status, due to the fact that no output file is specified (since I don't want to actually download the full audio file and convert it in any way).
Is there any way I can run avconv so that it
outputs the audio metadata of the remote file
doesn't download the remote file in full
returns an exit status of 0 if it was able to get this far
How about actually downloading the file only as a temp to work on, and then automatically delete it after the work's been done?
avconv -i http://myserver.com/my_music.mp3 -y /temp/temp.mp3 -f ffmetadata meta.ini
# delete temp file after it's been worked on
wait
echo "Done."
rm /temp/temp.mp3
Keep in mind that I wrote all the above from top of my head so it may contain some errors.
In order to extract the metadata of the provided audio file, you could also use a python script.
>>> from pydub.utils import mediainfo
>>> mediainfo("/temp/temp.mp3")
and add some bash snippets inside.
Related
I would prefer not to use Amazon, Google etc, so how would I use my own computer (macOS) to get a time-stamped transcription of mp3s and videos? Preferably on the command line. So I could do something like this
transcribe -o oliver_twist.srt oliver_twist.mp3
.. to create a SRT subtitle file from an mp3.
For Linux there's a package called voice2json: http://voice2json.org/commands.html#transcribe-wav
simply if you have an audio file: sample.wav you run
voice2json transcribe-wav < simple.wav
and you get the output
{"text": "sample voice recording", "transcribe_seconds": 0.123, "wav_seconds": 1.23}
I believe you can install this Linux package to macOS. To do that just look at: https://apple.stackexchange.com/questions/53096/is-it-possible-to-install-linux-packages-on-os-x
EDIT:
To get the srt, you need a package called jq. You can install it the same way. Let's say your output from previous command is output.json. What you need to do is:
jq .text output.json > subtitles.srt and the output will be saved as subtitles.srt
Kdenlive is able to generate SRT files from an audio file: see Kdenlive. It is also available for MacOs.
Once Kdenlive is installed, you can install Kdenlive command line tools to operate Kdenlive from the command line: see Kdenlive command line.
I am trying to run a script which finds the pitch of a waveform, however I am getting an error that it cannot open a wav file, and I don't know why this is.
The code is:
../../SPTK-3.11/bin/pitch/pitch -a 0 -s 16.0 -p 80 -t0 0.0 -L 40 -H 150 -o 1 ../wav/*.wav > f0
And the error is:
Cannot open file ../wav/arctic_a0254.wav!
There are around 500 wav files in the folder, so I don't know why it doesn't list the first here if there is a problem with the path or the file
I have already tried doing ls ../wav which shows all the files as being in that directory, and did open ../wav/arctic_a0254.wav which also worked, so I don't know why there is an error here.
EDIT: I tried removing the wav file from the folder, and got the same error with the proceeding wav file (arctic_a0255.wav), so I don't think it is to do with the individual wav file.
EDIT2: The script lists the error as occurring when there is an error seeking the beginning of the audio container, but I'm not sure what this means
EDIT3: Solved! The issue was the file not being a float, so I converted the wav in audacity and the script worked as normal
I believe that the program you are executing, pitch, runs out of file descriptors.
I don't know whether it fails to close already used files, thus leaking file descriptors, or whether it really needs to keep all those files open for performing its task, which would be more difficult to fix.
You can try to strace it and see the exact error you get from the read() system call just before bailing out.
Do you have access to the source?
Can you run it in smaller batches?
I am using FFMPEG to convert a stream on the fly, but i want to log all the errors in file. The file should be generated daily, whilst the stream is 24/7.
What command can i use?
At the moment i have used this command:
ffmpeg -i ... commands ..... -loglevel warning -report
I want the file to be written every day for the live stream, but each day makes it own file, instead of one file.
Thanks
I'm using bash via cygwin on a windows machine to batch-convert several hundreds of wav-files to flac. I wrote a simple script to read each file from a txt-file containing a directory-print I did earlier, convert the linuxpaths to windowspaths and using FLAC to encode the files.
#!/bin
IFS="$(printf '\n\t')"
(for wav in $(cat path/wavfiles.txt)
do
winwav= $(cygpath -w "$wav")
flac --best --verify "$winwav"
sleep 30
done)
The path conversion seems to be working fine: bash expands out the path correctly to a windows path for FLAC to use, but FLAC keeps spitting out the following error message:
ERROR: can't open input file : inavlid argument
I tried encoding the files with a similar script windows batch file and it worked fine, so the files aren't the problem. I searched a lot of sites, including this one and the FLAC-helppages, but I can't seem to find any information concerning this error message. Probably something silly I overlooked, it usually is.
Any ideas?
Hi i want to stream videos over web using ffserver. i got this link as reference.
Now what i am not able to figure out is how to pass a folder(which content all videos i want to stream) as input to stream all videos. I also want add more videos dynamically to this folder in time to time and streaming should happen(like how it works in Darwin). now i can't use Darwin because it doesn't support for iOS.
please give me a suggestion.
is there any other open source tool by which i can do this?
I wrote a bash script for this, it's working in ubuntu 16
Hopefully someone else can write it up in a less terrible language
Here's the script:
echo -e "HTTPPort 8090\nHTTPBindAddress 0.0.0.0\nMaxHTTPConnections 2000\nMaxClients 1000\nMaxBandwidth 1000\nCustomLog -\n<Stream stat.html>\nFormat status\n</Stream>"
num=1
for i in *.mp3; do
echo -e "<Stream \"$(urlencode $i)\">\nFile \"$(pwd)/$i\"\nFormat mp2\nAudioCodec libmp3lame\nAudioBitRate 64\nAudioChannels 1\nAudioSampleRate 44100\nNoVideo\n</Stream>"
done
save this as a bash script in the folder you want to serve, I'll refer to it as:
./gen_ffserver_conf.sh
it's hard coded for mp3, you'd have to sort through my echos to get it to do another format.
run the server with:
ffserver -f <(bash -e ./gen_ffserver_conf.sh)
I had to install a package for the url encoding:
sudo apt install gridsite-clients
(and of course you need ffserver as well, in the ffmpeg package)
I stream the files by going to:
http://<ip address of streaming server>:8090/stat.html
and clicking on the urlencoded values, (using chromium). This will open the stream and start playing.
Explanation:
ffserver doesn't like wildcards, or at least I never figured that out, so I'm just creating an entry for each file in the server. The urlencoding is annoying but necessary for the stat page links to work properly.