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.
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 have two IP Cameras, and I'm regularly collecting the dumped video stream in a file. Every 30 minutes I kill down the running processes, and restart dumping, using the "mplayer" command in background to generate a .mp4 file.
Basically I'm running something like this:
killall mplayer
mplayer -dumpstream rtsp://cam01:554/video.mp4 -dumpfile cam01.mp4 & bg
mplayer -dumpstream rtsp://cam02:554/video.mp4 -dumpfile cam02.mp4 & bg
Then I store all the resulting .mp4 files for future checks.
Now there is the problem: many files are perfectly readable (using VLC) and many files aren't (I'm just able to open "unreadable" files using the "ffplay" utility).
However, as I'm using a VLC app in a smart TV to open them, I'd like to be able to open all files in VLC. Could you please give me some advice?
I admit, I'm new to Linux, but I pieced together the following in the Ubuntu terminal to download all of the videos from a YouTube channel:
youtube-dl -o "/media/ubuntu/3A3A9F353A9EED5F/%(uploader)s/%(autonumber)s.%(title)s.%(ext)s" --download-archive ~/.mydownloads -citw ytuser:DirectFix
However, I keep getting this error:
youtube-dl: error: using output template conflicts with using title, video ID or auto number
What do I need to do so I can download the files straight to a separate internal drive, rename the files, and keep track of the videos I've already downloaded?
Your options -citw do not make any sense. Simply remove them (maybe leave -i) and the download will work.
In detail:
-c forces youtube-dl to always resume downloads. By default, youtube-dl does already resume downloads. At best, this option is superfluous. At worst, you may be forcing youtube-dl to resume a download in another quality, which will result in a broken video file.
-i makes youtube-dl continue if it cannot download a video from the playlist. Unlike the other options, it is regularly useful. Be aware that you may miss errors though, if you need a complete download.
-t is the equivalent of -o "%(title)s-%(id)s.%(ext)s". As such, it is causing the immediate error at hand, since you are passing in two different output templates and youtube-dl doesn't know which one to pick.
-w forces youtube-dl to never overwrite an existing file. This is useful for metadata files, which you don't use in the first place. Even then, most users will want the updated information.
I have a mp3 file with silence, s.mp3, which I'm trying to add to the end of an mp3 using:
cat file1.mp3 s.mp3 > file1.mp3
This worked fine for some mp3 files I downloaded from the net but not the files I created myself using lame.
I'm on mac os x.
Since I'm making the mp3 files myself with lame maybe I can do something that will allow then to work with cat.
How might I establish the problem?
Most file formats are too complicated for concatenation to work. If you know how to program, look at a class called AVAsset in the Mac OS X SDK documentation. If you do not want to program, you can probably find an App that concatenates audio files together.
(Although, to my surprise I do see a "MacHint" that claims that you can cat mp3s together).
Also, see https://superuser.com/questions/78912/free-mp3-merge-for-mac-os-x
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.