Convert MP4 to HLS with AWS Elastic transcoder. - amazon-elastic-transcoder

I am planning to convert MP4(1920x1080, bitrate may vary from mp4 to mp4) to HLS(different type of resolution).
different type of resolution, I am looking for
1080p = 1920x1080
720p = 1280x720
480p = 854x480
360p = 640x360
To achieve the above, I have written a Lambda functin in NodeJS and I have used below "System Presets". HLS O/P file is creating but the RESOLUTIONs are not as per my expectation. It's some time coming correct for few cases. But in generic the value(WxH) is not constant.
HLS v3 and v4 (Apple HTTP Live Streaming), 400 kilobits/second, Video-only --------- 1351620000001-200055
HLS v3 and v4 (Apple HTTP Live Streaming), 600 kilobits/second, Video-only --------- 1351620000001-200045
HLS v3 and v4 (Apple HTTP Live Streaming), 1 megabit/second, Video-only --------- 1351620000001-200035
HLS v3 and v4 (Apple HTTP Live Streaming), 1.5 megabits/second, Video-only --------- 1351620000001-200025
I tried but not getting any solution. I need the help of anyone to resolve my problems.

Thanks, your question is very clear. Recently I had experience same kind of issue. Please find the below solutions.
Here what I understand, you want specific resolution output files.
You have to create new custom presets.I am mentioning one custom preset for 1080p, you have follow for the rest.
1080p = 1920x1080
Create new presets : -
First of all you have to choose one existing System Presets. For example - System preset: HLS Video - 1.5M and change the configuration value in the video section only as per below settings
Name - Custom HLS Video Auto - 1080p
Container - ts
Codec - H.264
Codec Options - InterlacedMode:Progressive,MaxReferenceFrames:3,Level:3.1,ColorSpaceConversionMode:None,Profile:main
Max Bit Rate - left blank (optional)
Buffer Size - left blank (optional)
Maximum Number of Frames Between Keyframes - 90
Fixed Number of Frames Between Keyframes - true
Bit Rate - auto
Frame Rate - auto
Video Max Frame Rate - 30
Max Width - 1920
Max Height - 1080
Sizing Policy - Fit
Padding Policy - NoPad
Display Aspect Ratio - auto
These 3 settings are important
Max Width - 1920
Max Height - 1080
Sizing Policy - Fit
For other resolution, you have to create new custom presets by changing the Max Width & Max Height.Everything will remain same as it is.

Related

Simulate Camera in Numpy

I have the task to simulate a camera with a full well capacity of 10.000 Photons per sensor element
in numpy. My first Idea was to do it like that:
camera = np.random.normal(0.0,1/10000,np.shape(img))
Imgwithnoise= img+camera
but it hardly shows an effect.
Has someone an idea how to do it?
From what I interpret from your question, if each physical pixel of the sensor has a 10,000 photon limit, this points to the brightest a digital pixel can be on your image. Similarly, 0 incident photons make the darkest pixels of the image.
You have to create a map from the physical sensor to the digital image. For the sake of simplicity, let's say we work with a grayscale image.
Your first task is to fix the colour bit-depth of the image. That is to say, is your image an 8-bit colour image? (Which usually is the case) If so, the brightest pixel has a brightness value = 255 (= 28 - 1, for 8 bits.) The darkest pixel is always chosen to have a value 0.
So you'd have to map from the range 0 --> 10,000 (sensor) to 0 --> 255 (image). The most natural idea would be to do a linear map (i.e. every pixel of the image is obtained by the same multiplicative factor from every pixel of the sensor), but to correctly interpret (according to the human eye) the brightness produced by n incident photons, often different transfer functions are used.
A transfer function in a simplified version is just a mathematical function doing this map - logarithmic TFs are quite common.
Also, since it seems like you're generating noise, it is unwise and conceptually wrong to add camera itself to the image img. What you should do, is fix a noise threshold first - this can correspond to the maximum number of photons that can affect a pixel reading as the maximum noise value. Then you generate random numbers (according to some distribution, if so required) in the range 0 --> noise_threshold. Finally, you use the map created earlier to add this noise to the image array.
Hope this helps and is in tune with what you wish to do. Cheers!

How to get NED velocity from GPS?

I have an Adafruit Ultimate GPS module which I am trying to fuse with a BNO055 IMU sensor. I'm trying to follow https://github.com/slobdell/kalman-filter-example this kalman-filtering example. Although most of his code is pretty clear, I looked at his input json file(https://github.com/slobdell/kalman-filter-example/blob/master/pos_final.json) and saw that he's getting velocity north, velocity east and velocity down from the GPS module. I looked at the NMEA messages and none seem to give me that. What am I missing? How to get these direction velocities?
Thanks!
pos_final.json is not the input file, but the output file. The input file is taco_bell_data.json and is found in the tar.gz archive. It contains the following variables:
"timestamp": 1.482995526836e+09,
"gps_lat": 0,
"gps_lon": 0,
"gps_alt": 0,
"pitch": 13.841609,
"yaw": 225.25635,
"roll": 0.6795258,
"rel_forward_acc": -0.014887575,
"rel_up_acc": -0.025188839,
"abs_north_acc": -0.0056906715,
"abs_east_acc": 0.00010974275,
"abs_up_acc": 0.0040153866
He measures position with a GPS and orientation/acceleration with an accelerometer. The NED velocities that are found in pos_final.json are estimated by the Kalman filter. That's one of the main tasks of a Kalman filter (and other observers): to estimate unknown quantities.
A GPS will often output velocities, but they will be relative to the body of the object. You can convert the body-relative velocties to NED-velocities if you know the orientation of the body (roll, pitch and yaw). Let's say you have a drone moving at heading 030°, and the GPS says the forward velocity is 1 m/s, the drone will have the following North velocity:
vel_north = 1 m/s * cos(30°) = 0.86 m/s
and the following East velocity:
vel_east = 1 m/s * sin(30°) = 0.5 m/s
This doesn't take into account roll and pitch. To take roll and pitch into account you can take a look at rotation matrices or quaternions on Wikipedia.
The velocities are usually found in the VTG telegram the GPS outputs. It's not always being output. The GPS has to have that feature and it has to be enabled on the GPS. The RMC telegram can also be used.
The velocities from the GPS are often very noisy, which is why a Kalman filter is typically used instead of converting the body-relative velocities to NED-velocities with the method above. The GPS velocities will work fine in higher speeds though.

GNURadio Companion Blocks for Z-Wave using RTL-SDR dongle

I'm using RTL-SDR generic dongle for receiving frames of Z-Wave protocol. I use real Z-Wave devices. I'm using scapy-radio and I've also downloaded EZ-Wave. However, none of them implements blocks for all Z-Wave data rates, modulations and codings. I've received some frames using original solution of EZ-Wave, however I assume I can't receive frames at all data rates, codings and modulations. Now I'm trying to implement solution according to their blocks to implement all of them.
Z-Wave procotol uses these modulations, data rates and coding:
9.6 kbps - FSK - Manchester
40 kbps - FSK - NRZ
100 kbps - GFSK - NRZ
These are my actual blocks (not able receving anything at all right now):
For example, I will explain my view on blocks for receiving at
9.6 kbps - FSK - Manchester
RTL-SDR Source
variable center_freq = 869500000
variable r1_freq_offset = 800e3
Ch0: Frequency: center_freq_3-r1_freq_offset, so I've got 868.7 Mhz on RTL-SDR Source block.
Frequency Xlating FIR Filter
Center frequency = - 800Khz to get frequency 868.95 Mhz (Europe). To be honest, I'm not sure why I do this and I need an explanation. I'm trying to implement those blocks according to EZ-Wave implementation of blocks for 40 kbps-FSK-NRZ (as I assume). They use sample rate 2M and different configurations, which I did not understand.
Taps = firdes.low_pass(1,samp_rate_1,samp_rate_1/2,5e3,firdes.WIN_HAMMING). I don't understand, what should be transition bw (5e3 in my case)
Sample rate = 19.2e3, because data rate/baud is 9.6 Kbps and according to Nyquist–Shannon sampling theorem, sampling rate should be at least double to data rate, so 2*9.6=19.2. So I'm trying to resample default 2M from source to 19.2 Kbps.
Simple squelch
I use default value (-40) and I'm not sure, if I should change this or not.
Quadrature Demod
should do the FSK demodulation and I use default value of gain. I'm not sure if this is a right way to do FSK demodulation.
Gain = 2(samp_rate_1)/(2*math.pi*20e3/8.0)*
Low Pass Filter
Sample rate = 19.2k to use the same new sample rate
Cuttoff Freq = 9.6k, I assume this according to https://nccgroup.github.io/RFTM/fsk_receiver.html
Transition width = 4.8 which is also sample_rate/2
Clock Recovery MM
Most of the parameters are default.
Omega = 2, because samp_rate/baud
Binary Slicer
is for getting binary code of signal
Zwave PacketSink 9.6
should the the Manchester decoding.
I would like to ask, what should I change on my blocks to achieve proper receiving of Z-Wave frames at all data rates, modulation and coding. When I start receiving, I'm able to see messages from my devices at FFT sink and Waterfall sink. The message debug doesn't print packets (like from original EZ-Wave solution) but only
Looking for sync : 575555aa
Looking for sync : 565555aa
Looking for sync : aa5555aa
what should be value in frame_shift_register, according to C code for Manchester decoding (ZWave PacketSink 9.6). I've seen similar post, however this is a bit different and to be honest, I'm stuck here.
I will be grateful for any help.
Let's look at the GFSK case. First of all, the sampling rate of the RTL source, 2M Baud is pretty high. For the maximum data rate, 100 kbps - GFSK, a sample rate of say 400 ~ 500kbaud will do just fine. There is also the power squelch block. This block prevents signals below a certain threshold to pass. This is not good because it filters low power signals that may contain information. There is also the sample rate issue between the lowpass filter and the MM clock recovery block. The output of the symbol recovery block should be 100kbaud (because for GFSK, sample rate = symbol rate). Using the omega value of 2 and working backward, the input to the MM block should be 200kbaud. But, the lowpass filter produces samples at 2Mbaud, 10 times than expected. You have to do proper decimation.
I implemented a GFSK receiver once for our CubeSat. Timing recovery was done by the PFB block, which is more reliable than the MM one. You can find the paper here:
https://www.researchgate.net/publication/309149646_Software-defined_radio_transceiver_for_QB50_CubeSat_telemetry_and_telecommand?_sg=HvZBpQBp8nIFh6mIqm4yksaAwTpx1V6QvJY0EfvyPMIz_IEXuLv2pODOnMToUAXMYDmInec76zviSg.ukZBHrLrmEbJlO6nZbF4X0eyhFjxFqVW2Q50cSbr0OHLt5vRUCTpaHi9CR7UBNMkwc_KJc1PO_TiGkdigaSXZA&_sgd%5Bnc%5D=1&_sgd%5Bncwor%5D=0
Some more details on the receiver could also be found here:
GFSK modulation/demodulation with GNU Radio and USRP
M.
I appreciate your answer, I've changed my sample rates. Now I'm still working on 9.6Kbps, FSK demodulation and Manchester decoding. Currently, output from my M&M clock recovery looks like this:
I would like to ask you what do think about this signal. As I said, it should be FSK demodulation and then I should use Manchester decoding. Do I still need usage of PCB block? Primary, I have to do 9.6kbps, FSK and Manchester, so I will look at 100Kbps GFSK NRZ if there will be some time left.
Sample rate is 1M because of RTL-SDR dongle limitations (225001 to 300000 and 900001 to 3200000).
Current blocks:
I don't understand :
Taps of Frequency Xlating FIR Filter firdes.low_pass(1,samp_rate_1,40e3,20e3,firdes.WIN_HAMMING)
Cuttoff Freq and Transition Width of Low Pass filter
Clock Recovery M&M aswell, so consider its values "random".
ClockRecovery Output:
I was trying to use PCB block according to your work at ResearchGate. However, I was unsuccessful because I still don't understand all that science behind the clock recovery.
Doing Low-pass filtering twice is because original Z-Wave blocks from scapy-radio for 40Kbps, FSK and NRZ coding are made like this (and it works):
So I thought I will be just about changing few parameters and decoder (Zwave PacketSink9.6).
I also uploaded my current blocks here.
Moses Browne Mwakyanjala, I'm also trying to implement that thing according to your work.
Maybe there is a problem with a clock recovery and Manchester decoding. Manchester decoding use transitions 0->1 and 1->0 to encode 0s and 1s. How can I properly configure clock recovery to achieve correct sample rate and transitions for Manchester decoding? Manchester decoder (Z-Wave PacketSink 9.6) is able to find the preamble and ends only with looking for sync.
I would like to also ask you, where can I find my modulation index "h" mentioned in your work?
Thank you

What is the unit for raw data in Kinect V2?

I am trying to figure out what is the raw data in Kinect V2? ... I know we can convert these raw data to meters and to gray color to represent the depth .... but what is the unit of these raw data ?
and why all the images that captured by Kinect are mirrored?
The raw values stored in the depth image are in millimeters. You can get the X and Y values using the pixel position along with the depth camera intrinsic parameters. If you want I could share a Matlab code that converts the depth image into X,Y,Z values.
Yes, the images are mirrored in Windows-SDK and in the "libfreenect2" which is a open source version of SDK. I couldn't get a solid answer why it is so, but you could look at the discussion available in the link.
There are different kinds of frame which can be captured through Kinect V2. Every raw data captured has a different unit. Like, for depth frame it is millimeters, for color it is RGB (0-255, 0-255, 0-255), for bodyFrames it is 0 or 1 ( having same resolution as depth frame, but can identify up-to a maximum number of human bodies at a time ) and etc.
Ref: https://developer.microsoft.com/en-us/windows/kinect

How to get the default image of Wikipedia article?

Is it possible to get the (default) image associated with a Wikipedia article with an API call if only the URL of the article is known?
Is it possible to make constraints about the image size / resolution in the call (as an image is usually available in different resolutions)?
Is it possible to request the largest image version not larger than MAX_X px?
An example:
https://upload.wikimedia.org/wikipedia/commons/e/e9/Jaguar_%28Panthera_onca_palustris%29_female_Piquiri_River_2.JPG
is 4769x3179 large (1,5 ratio).
A request limiting the MAX_X size to 3000 would result in an image scaled to 3000x2000.
A request limiting the MAX_X size to 5000 would result in the image of the original size (4769x3179) because MAX_X is bigger than the image's x size.
Use MediaWiki API with pageimages. For example for Wikipedia article Jaguar and requested max image size 500 the query will be:
https://en.wikipedia.org/w/api.php?action=query&prop=pageimages&titles=Jaguar&pithumbsize=500
From the response you can get also the largest image version, just remove the thumb part and everything from the pixels to the end of the link.