I am using gstreamer 0.10 version.
My usecase is with two branches (tee element). In one of them I have ->decoder->tee->jpegenc->output-selector->fakesink
->multifilesink
This is implemented in application. Now I am switching between the both outputs with g_timeout_add but in this case if it is connected 10s to the fakesink it is connected same time to the multifilesink. I want to archive: if I press a button to save only one frame as jpg. If I press it again I should save it under different name(that is why I am using multifilesink, the filesink will overwrite it). Could someone helps me with tips please how can I archive this with the event from the keyboard.
First, 0.10 is years obsolete and unmantained, please consider moving to 1.0 versions.
This is more a case of looking how to read chars from the console. You can use getchar() or use GIOChannel as you might also need a mainloop for your application (https://developer.gnome.org/glib/stable/glib-IO-Channels.html#g-io-channel-read-chars). An example of using GIOChannel. One example application can be found here: https://github.com/thiagoss/gst-test-apps/blob/master/apps/dvbsrc-capture-freq-switch.c (though it waits to read a whole line but you can modify to suit your needs).
Another advice I'd give on your pipeline is to have the output-selector before the jpegenc to avoid encoding images just to discard. Also, it might be easier to achieve what you want by using a buffer pad probe that would return FALSE to drop the buffer or TRUE to let it pass in 0.10 or the _DROP and _OK returns in 1.0 (go for 1.0!). It will be easier than using an output-selector for your case.
Related
I am using Wowza Engine 4.5.0 and I am trying to change the chunk ID numbering based on incoming packet time, instead of the default sequential number that cause problems when restarting the encoder.
From something like this
...media_w112312312_b1024000_7.ts
...media_w112312312_b1024000_8.ts
to a timestamp notation where the chunks continue even after a restart
I read about the property cupertinoCalculateChunkIDBasedOnTimecode, I follow the instructions in this guide to configure it:
https://www.wowza.com/docs/how-to-configure-apple-hls-packetization-cupertinostreaming#livepropref
but it does not work or I am doing something wrong. Has anyone used the property
cupertinoCalculateChunkIDBasedOnTimecode successfully?
many thanks
I have used 'cupertinoCalculateChunkIDBasedOnTimecode' property and even if I restart my encoder, players are able to pick up the stream and play successfully.
The below page will help you in using it properly
http://thewowza.guru/how-to-set-stream-timecodes-to-absolute-time/
I want a video to be repeated infinite number of times till i press enter key or anyother key stroke.
The event part can be handled easily. What im worried about is how to repeat or loop the video continuously.
A little research showed me that the IWMPSettings has a SetMode function which can be used in following manner to loop video
SetMode("loop",true); But however, this doesnt work as i think this function works only if u have playlist.
Is there no alternative to run a single video continuously without using PlayList? If not, how do i create playlist?
It's hard to say whether this is viable since the constraints of your problem aren't known, but it may be easier just input the corresponding keyboard shortcuts for whatever you want to do in wmp.
http://windows.microsoft.com/en-us/windows/media-player-keyboard-shortcuts
I was happily improving my C++-program where I read videos via directshow. Now I tried to also write videos which was also nicely working.
Then came the search for an appropriate codec (thought about vob/ogg)...
However, suddenly today the video was displayed really slowly.
And now that I uninstalled any additional codecs I installed before, the video won't play at all.
The reason seems to be CComQIPtr< IMediaSeeking, &IID_IMediaSeeking > pSeeking( pGraph ); and hr = pSeeking->SetPositions( &Startzeit, AM_SEEKING_AbsolutePositioning,NULL, AM_SEEKING_NoPositioning ); gives an error, SetPosition is not supported at that time... acutally at any time.
also hr=pSeeking->GetDuration(&duration) returns 0 and the corresponding AM_MEDIA_TYPE mt; I use to get the framepersecond has an empty format-type. (pbFormat is Null).
Did I unintentionally installed/uninstalled something important?
Have you heard of similar problems?
As I said, some days ago the same video and source-code was working fine (I commented by changes out by now).
I would like to give you more source-code but it is kind of long but if you think it would be helpful I will add it of course.
Regards,
Julian
Here is the source-code: http://pastebin.com/jMdWejH9
It's of course only a part of the whole code, but I think this is the main part as here are all filters inserted.
Keep in mind that this actually worked until some days before!^^
The first part is the variable-deklaration (all important variables as fas as I could tell, the second is the function called)
If you render a file in DirectShow, the framework uses the installed codecs/filters in the system. If you remove some codecs it takes another or breaks because it can't render. To know wich filters the framework uses you can try to render the file in GraphEdit or GraphStudioNext. (Just drop the file on one of these programms and see the filtergraph). We got the best results with the codec pack ffdshow-tryouts and the Haali Media Splitter for our player.
I have a console app that needs to display the state of items, but rather than having text scroll by like mad I'd rather see the current status keep showing up on the same lines. For the sake of example:
Running... nn% complete
Buffer size: bbbb bytes
should be the output, where 'nn' is the current percentage complete, and 'bbbb' is a buffer size, updated periodically on the same lines of the console.
The first approach I took simply printed the correct number of backspaces to the console before printing the new state, but this has an obnoxious flicker that I want to get rid of. I also want to stick to either standard library or MS-provided functionality (VC 8) so as not to introduce another dependency for this one simple need.
You can use SetConsoleCursorPosition. You'll need to call GetStdHandle to get a handle to the output buffer.
Joseph, JP, and CodingTheWheel all provided valuable help.
For my simple case, the most straight-forward approach seemed to be based on CodingTheWheel's answer:
// before entering update loop
HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_SCREEN_BUFFER_INFO bufferInfo;
GetConsoleScreenBufferInfo(h, &bufferInfo);
// update loop
while (updating)
{
// reset the cursor position to where it was each time
SetConsoleCursorPosition(h, bufferInfo.dwCursorPosition);
//...
// insert combinations of sprintf, printf, etc. here
//...
}
For more complicated problems, the full console API as provided by JP's answer, in coordination with the examples provided via the link from Joseph's answer may prove useful, but I found the work necessary to use CHAR_INFO too tedious for such a simple app.
If you print using \r and don't use a function that will generate a newline or add \n to the end, the cursor will go back to the beginning of the line and just print over the next thing you put up. Generating the complete string before printing might reduce flicker as well.
UPDATE: The question has been changed to 2 lines of output instead of 1 which makes my answer no longer complete. A more complicated approach is likely necessary. JP has the right idea with the Console API. I believe the following site details many of the things you will need to accomplish your goal. The site also mentions that the key to reducing flicker is to render everything offscreen before displaying it. This is true whenever you are displaying anything on the screen whether it is text or graphics (2D or 3D).
http://www.benryves.com/tutorials/?t=winconsole
In case the Joseph's suggestion does not give you enough flexibility, have a look at the Console API: http://msdn.microsoft.com/en-us/library/ms682073(VS.85).aspx.
In Linux, you can accomplish this by printing \b and/or \r to stderr. You might need to experiment to find the right combination of things in Windows.
I have got the following situation. On a machine there is a Fritz ISDN card. There is a process that is responsible for playing a certain wave file on this device's wave out (ISDN connection is made at startup and made persistent). The scenario is easy, whenever needed the process calls waveOutWrite() on the previously opened wave device (everything initialized without any problems of course) and a callback function waits for MM_WOM_DONE msg to know that the playback has been finished.
Since a few days however (nothing changed neither in the process nor the machine) the MM_WOM_DONE message has been coming immediately after calling waveOutWrite() even though the wave lasts a couple of seconds. Again no error is reported, it looks like the file was played but had zero length (which is not the case). I am also sure that waveOutReset() was not called by my process (it would also trigger sending the mentioned message). I have already used to have some strange problems in the past that where solved simply by reinstalling TAPI drivers. This time for some reason it is problematic for me to perform that once again and I am trying more analytical approach :). Any suggestions what might cause such a behavior? Maybe something on the other end of the ISDN line?
Based on your description, you are doing the playing asynchonously. Are you sure that the backing memory for the wav file is not being cleaned up in that time?
I don't have the time to Google too much for this, but I know that either Larry Osterman or Raymond Chen blogged about a similar situation.
I'll check back later when I have more time to see if this question is still open.
What is the return value when the sound does not play? If you get MMSYSERR_NOERROR that points to the driver incorrectly reporting to the OS that the buffer was processed.
Has the WAV file itself changed? This blog entry indicates that some pretty in-depth validation is done on the metadata.