ffmpeg streaming multiple avi files as created - ffmpeg

Backstory:
I have a VB.net program (that is using a much older COM object accessing a DVR) to create sequentially numbered AVI files each 15 seconds in length. A new AVI is created every 15 seconds with the most recent 15 seconds of video in it. I know the exact datetime that correlates to each file. So files may be named (20121008-133445.avi, so yyyyMMdd-hhmmss.avi).
Question: Using ffmpeg/ffserver (preferably but I'm open), how can I create a stream such that when a person accesses it that they are presented a continuous video that starts at a position that is as recent as possible and continues to stream the avi files as they are created?
I don't have a problem shipping these files off to a Linux box via a samba share (or have the linux box access a share on the windows box) if Linux is more capable. I am however stuck with Windows for the actual generation of the original AVI files.
The ultimate goal is to be able to view these streams on an iPad, but that process seems pretty well documented elsewhere.
I found a question that reads similar to my needs but didn't seem to go anywhere: FFmpeg make mpeg2 ts without discontinuity
Thanks in advance!

Why don't you write a small program that simply reads these files one after another continously and dumps them to a named pipe. Ffmpeg can then read from the named pipe and it will think it is one file.
The more complex solution is to use multifilesrc from gstreamer.

Related

ffmpeg crashes when extracting PNG's from video

I am attempting to extract PNG's from a video (.avi) using ffmpeg. My code is:
ffmpeg -i vidx.avi -f image2 imgx_%d.png
Normally that would work fine, but just now it has been causing ffmpeg to crash, a box appears telling me 'ffmpeg.exe has stopped working .. etc...', however changing from png's to jpeg's and the problem goes away.
The format of the video doesn't seem to matter, an mp4 and mpg also have the same issue as the avi.
This has only just happened (in the past day) on a Windows 10(x64)PC so, could it be related to a MS/Windows Update.. is that possible? Does anyone know what else could cause this?
Looking at recently installed programs, realised I'd installed ImageMagick, which has a command-line interface and the Environmental Variable, which was automatically set, is for the folder that not only includes the "magick.exe" but also an "ffmpeg.exe" (version 3.4), and as this was on the Environmental Variables list first, Windows assumed that was the version to use, and not the standalone version that I normally use (a nightly-build from http://ffmpeg.zeranoe.com/builds/).
So just moving the standalone version above the ImageMagick entry did the trick.

Multiple sound card output under Windows with Liquidsoap

Is it possible to output to multiple sound cards under Windows?
It seems that portaudio is the only way to play back through a sound card with Windows, but portaudio offers no mechanism for choosing which device to output to. Even if it did, it isn't clear that it would be possible to open multiple outputs.
Currently, I'm using a hack using VLC to output to the sound cards:
output.external(
%mp3(bitrate=320,stereo_mode="stereo"),
'"C:\\Program Files (x86)\\VideoLAN\\VLC\\vlc.exe" -vvv --config C:\vlc\vlcrc-remote1 -',
remote1
)
output.external(
%mp3(bitrate=320,stereo_mode="stereo"),
'"C:\\Program Files (x86)\\VideoLAN\\VLC\\vlc.exe" -vvv --config C:\vlc\vlcrc-remote2 -',
remote2
)
Each VLC profile has a different sound device set by default. Obviously this could be improved by switching to PCM, but if I can simply skip the whole external process issue completely, that would be great.
This is probably too late now...
Having been searching for this for a all night (several hours) and delving into the source code for PortAudio and Liquidsoap, I have established that LS utilises Pa_OpenDefaultStream() to open one stream only. It is not possible through LS' interface to pass a PA ID to input or output.portaudio. It will always default to device 0 which is the sound mapper (Windows default device).
However, all is not lost, in order to tell PortAudio which input/output to use, you can pass an environment variable before running LS:
set PA_RECOMMENDED_OUTPUT_DEVICE=x
set PA_RECOMMENDED_INPUT_DEVICE=x
Where x is a PA device reference. To find your device references you need a copy of pa_devs.exe (I found a copy here http://www.w1hkj.com/alpha/temp/pa_devs.exe) which when ran generates results.txt. This file contains the IDs you need. You can also get the IDs with Audacity by selecting Help>Audio Device Info.
So you could in theory do multiple outputs like this:
setenv("PA_RECOMMENDED_OUTPUT_DEVICE","13")
streamout1 = output.portaudio()
setenv("PA_RECOMMENDED_OUTPUT_DEVICE","14")
streamout2 = output.portaudio()
I don't know for definite if this will work but it's worth a go! If it doesn't work, you could always run two liquidsoap instances in different settings if this would work for your application.

Why FFMPEG's -movflags faststart parameter makes empty files when output is over network drives?

I made an application that uses ffmpeg to compress video files. There are 3 computers crunching the files from and to a Synology NAS.
Everything works great, but if I add the parameter "-movflags faststart" the resulting file ends being 0Kb.
The same commands works well if output file is on local hard drive.
I need this parameter to move the moov atom at the begining so making the file suitable for progressive download.
I have seen problems in the past getting accurate stats/seeks of files on file servers. Similar behavior could be stopping ffmpeg from doing its job. Can you adjust your app to pull the files down to the local drive for ffmpeg processing? I don't know that you'd loose much time, if any, since ffmpeg would probably need to read/write just as many bytes over the network.

Recording Audio Output from a Specific Program on Windows

Is there any way to record the sound output of a specific program on Windows? I already have a solution that uses WASAPI's loopback device to record all audio output to the speakers, but I would prefer to be able to record only the audio output of a specific program and ignore everything else. I assume this is possible using a virtual audio device, but I would like to avoid something so complicated if possible.
According to this post (which is very interesting in itself), there's a program called
Virtual Audio Cable which might do the trick for you....
Virtual Audio Cable will do what you already mentioned when you said it captures all audio sent to it.
You can a Virtual Line to be the default and then record that Virtual Line. You can Not select a specific program to do such a thing.
I have made a tutorial for using it.
https://www.youtube.com/watch?v=WUQmkgw8Pjg
I use it to play music from youtube through my "mic" while playing games.
On Windows 10, You may check here, which use ActivateAudioInterfaceAsync Win32 API ; "Note that this sample requires Windows 10 build 20348 or later."

how can i check the presence of sound in a video using a script

Hi
i am working for a broadcasting company, we have a PC with TV tuner Card (windows xp), this PC is recording channel TV 24h/24 no stop.
the output are video files "wmv" each one has a duration of an hour.
The video files are copied automatically to a NAS, then final users works on them.
the problem is sometimes, there is no signal in the antenna, or there is just video without sound, then the video files recorded are no more exploitables.
i am searching for a way to write a script that can check a file after being recorded before being transfered to the NAS, the script must check the presence of the sound (perhaps volume statistics) to be sure the sounds exists really, same thing of video.
(for video i am using a script checking the size of the file)
is there anyway to do so ?
is there any command line in vlc, mplayer, media player classic, ..... ?
Thanks
Perhaps you can use ffmpeg (http://linux.byexamples.com/archives/229/extract-audio-from-video-or-online-stream/) to dump the audio to a seperate file in a compressed state, and the filesize can give you some information about the amount of data?

Resources