I am using VLC for HTTP live streaming as explained in Graffen's blog. Everything is working as expected. But I want to make the index number for ts files to wrap around after a certain count. For eg. I set "dst=c:/inetpub/wwwroot/live/mystream-########.ts". Then files with name mystream-00000001.ts, mystream-00000002.ts etc are produced with an always incrementing index file numbers. I want to make these index numbers to wrap around after a certain count, say after 10 files. So VLC will produce files from mystream-00000001.ts to mystream-00000010.ts and then again mystream-00000001.ts after mystream-00000010.ts instead of mystream-00000011.ts. What VLC command line setting can I use to make the ts file index number to wrap around?
I might not understand your question right, but wouldn't
"dst=c:/inetpub/wwwroot/live/mystream-#.ts"
wrap around at exactly 10 files? And
"dst=c:/inetpub/wwwroot/live/mystream-##.ts"
at 100.
Or you need an arbitrary number, not just powers of 10?
Related
Im trying to make a game on Scratch that will use a feature to generate a special code, and when that code is input into a certain area it will load the stats that were there when the code was generated. I've run into a problem however, I don't know how to make it and I couldn't find a clear cut answer for how to make it.
I would prefer that the solution be:
Able to save information for as long as needed (from 1 second to however long until it's input again.)
Doesn't take too many blocks to make, so that the project won't take forever to load it.
Of course i'm willing to take any solution in order to get my game up and running, those are just preferences.
You can put all of the programs in a custom block with "Run without screen refresh" on so that the program runs instantly.
If you save the stats using variables, you could combine those variable values into one string divided by /s. i.e. join([highscore]) (join("/") (join([kills]) (/))
NOTE: Don't add any "/" in your stats, you can probably guess why.
Now "bear" (pun) with me, this is going to take a while to read
Then you need the variables:
[read] for reading the inputted code
[input] for storing the numbers
Then you could make another function that reads the code like so: letter ([read]) of (code) and stores that information to the [input] variable like this: set [input] to (letter ([read]) of (code)). Then change [read] by (1) so the function can read the next character of the code. Once it letter ([read]) of (code) equals "/", this tells the program to set [*stat variable*] to (input) (in our example, this would be [highscore] since it was the first variable we saved) and set [input] to (0), and repeat again until all of the stats variables are filled (In this case, it repeats 2 times because we saved two variables: [highscore] and [kills]).
This is the least amount of code that it takes. Jumbling it up takes more code. I will later edit this answer with a screenshot showcasing whatever I just said before, hopefully clearing up the mess of words above.
The technique you mentioned is used in many scratch games but there is two option for you when making the save/load system. You can either do it the simpler way which makes the code SUPER long(not joking). The other way is most scratchers use, encoding the data into a string as short as possible so it's easy to transfer.
If you want to do the second way, you can have a look at griffpatch's video on the mario platformer remake where he used a encode system to save levels.https://www.youtube.com/watch?v=IRtlrBnX-dY The tips is to encode your data (maybe score/items name/progress) into numbers and letters for example converting repeated letters to a shorter string which the game can still decode and read without errors
If you are worried it took too long to load, I am pretty sure it won't be a problem unless you really save a big load of data. The common compress method used by everyone works pretty well. If you want more data stored you may have to think of some other method. There is not an actual way to do that as different data have different unique methods for things working the best. Good luck.
I have the following flowgraph to capture a small specified band. It seems that the final file sink never gets written to because it always has a 0 byte size.
This is the first time I have tried to use the Head and Skip Head blocks, so I am not sure if it has something to do with them or not. Initially only the first file was being written to, but as I increased the vec_size variable the second, third, and fourth files were being written to as well. No matter how large I make the vec_size variable though, I can't seem to get any data written to the fifth file sink. Does anyone know if it's an issue with the Head/Skip Head blocks or possibly something else I'm not seeing?
I employ a snippet to get the number of child elements, returning an integer:
[[!getChildCount? &id=`12345`]]
Depending on the result of this (zero or greater than zero), I want to load two different chunks into my website. Here is my "Modx-Pseudocode" of what I would like to achieve. Been fiddling for hours now and just can't find out about the right syntax. This is what I'd like to write inside the content field:
[[!If [[!getChildCount? &id=`45`]] > 0
then=`[load_chunk_A]`
else=`[load_chunk_B]`]]
Any hints of how this is properly expressed in Modx revolution?
Seems you are talking about IF extra that you should install, if you haven't already done it, to achieve your goal.
[[!If?
&subject=`[[!getChildCount? &id=`45`]]`
&operator=`>`
&operand=`0`
&then=`[[!$chunk_A]]`
&else=`[[!$chunk_B]]`
]]
I need to append MIDI files: leave header (same for all files) and other meta information, just copy music/score part.
I already have MIDI files in appropriate bytearrays, as I guessed I need to use writeBytes, but unfortunately couldn't find which bytes I need to take and copy.
Something like this:
var newFileBytes:ByteArray=new ByteArray();
newFileBytes.writeBytes(firstMIDIBytes);
newFileBytes.writeBytes(secondMIDIBytes,8);
Works only partially, file is playable; first part fully and second - only some notes (then player hangs out)
To say truth byteArrays aren't my strong side, as the MIDI file structure.
Can you suggest how to solve this?
Thanks in advance.
As per my comment, you probably mean to append these files, not merge them. Assuming that to be the case, you can't simply slap the data from the second file to the end of the first. As the MIDI protocol is bandwidth-optimized, it makes a number of assumptions regarding the streaming of events. These behaviors mean that you must take special care when appending MIDI data.
MIDI files can (and usually) use running status, which means that an even may omit the status byte, in which case the event should use the status byte of the previous event. This may not be the cause of your problems, but are you absolutely sure that you are only parsing raw MIDI data, and not the file headers and such? If this were the case, all sorts of weird data would be erroneously interpreted as valid MIDI events.
Events in MIDI files use relative offsets to the previous event in the sequence. The way that this is calculated is a bit complicated, but it involves a few properties (such as tempo, number of pulses/sec, etc) which are defined in the MIDI file header. If you stripped these events, and the properties are different for the second file, then the timing of these events will be wrong.
Basically, the only safe way to append the two MIDI files is to play them through a sequencer and re-write them to a new stream. Appending the byte arrays will probably be the cause of many mysterious bugs.
The structure of a MIDI file doesn't allow you to just "append" more data to it, for the following reasons:
Each track ends with an End of Track event, rendering all notes after that event meaningless.
Each track header chunk defines the size of the data that follows. Even if you append new data, any reader will only read [size] bytes before it starts looking for a new track.
A MIDI file defines how many tracks are present in the file, so even if you appended the byte array of a single MIDI track, unless you also update the track count of the header data, any reader would simply ignore the track you added.
If you add data to a MIDI file, you need to make sure the structural integrity of the file format is maintained. Simply appending data does not accomplish this.
I have video files, that I want to pad with a random number of extra bytes, in order to create a different md5 checksum. Is there a way to do that, and keep them playable?
It depends on the video file format, but you should be able to just add the extra bytes to the end, and most video players should ignore them. Most video formats contain a lot of metadata about the video data (such as "the total video size is X bytes"), so they're robust against this sort of change.
One simple way to do this is to use the >> shell redirection operator to append data, e.g.:
# Add 32 random bytes to the end of the movie.avi
head -c 32 /dev/urandom >> movie.avi
Metadata would be a good thing to change. If the file has metadata about the time the film was made or the software used for encoding, changes to those values should not have any effect on the final result. You'd need to specify the format.
Yegor,
It depends entirely on the video format. Look it up on wikipedia, some have a end of file flag byte sequence, simply adding bytes after it will achieve your effect, others will not work out so simply.