I'm trying to stream MPEG-TS using VLC as UDP Multicast. I have a recorded file with several programs. I need receive each program on my output as single program TS.
I do it with console interface in ubuntu 14.04 and I have a problem. I cannot get on my output any program except the first one.
cvlc MyMPTS.ts --sout '#duplicate{dst=udp{mux=ts,dst=239.233.1.1:5510},select="program=1"}' -
this command works well, but if I try adding another program to chain or I change my program number to another I got a following output:
[0x7ff748c93c38] main decoder error: cannot create packetizer output (mpga)
[0x7ff748c8c168] main decoder error: cannot create packetizer output (mpgv)
And there is nothing on output
If I stream using GUI it works well. I can select any program in my MPTS and get it on output, I can launch several windows of VLC and setup streaming with different programs as well. But GUI doesn't work in my case.
Why vlc cannot work with programs except the first defined from source file
Using you command I get:
[00007fa880008b38] stream_out_standard stream out error: UDP output is only valid with TS mux
[00007fa880008b38] stream_out_standard stream out error: no suitable sout mux module for `udp/ts://...'
This seems to be fixed by removing the mux=ts from dst=udp:
cvlc input.ts --sout '#duplicate{dst=udp{dst=...},select="program=94",dst=udp{dst=...},select="program=102"}'
It will still complain about mpga and mpgv but it will start sending mpeg-ts over UDP. No idea what it doesn't like though, maybe something to do with muxer selection.
Related
I am using a RPi Pico, a NB-IoT SIM7020E Module from Waveshare and a Twilio Super SIM card. I fitted the Raspberry Pi Pico into the SIM7020E module using header pins: a picture of the setup is given through this link (Picture 1: Hardware setup).
To send different AT commands to configure the modem and set up the APN, I used Micro Python and copy pasted the Python code into Putty (after doing ctrl C, ctrl E and ctrl D to run the code). The main functions I utilised to send AT commands are “uart.write”, “uart.any” and “uart.read”. I have copy-pasted a portion of the code here:
#Send an AT command - just return the response
def send_at_get_resp(cmd, timeout=1000):
# Send the AT command
uart.write((cmd + "\r\n").encode())
# Read and return the response (until timeout)
return read_buffer(timeout)
#Read in the buffer by sampling the UART until timeout
def read_buffer(timeout):
buffer = bytes()
now = ticks_ms()
while (ticks_ms() - now) < timeout and len(buffer) < 1025:
if uart.any(): # check if there is anything to be read
buffer += uart.read(1) # read 1 characters, returns a bytes object
return buffer.decode()
#Send an AT command - return True if we got an expected otherwise False
def send_at(cmd, back="OK", timeout=1000):
# Send the command and get the response (until timeout)
buffer = send_at_get_resp(cmd, timeout)
if len(buffer) > 0:
return True
else:
return False
send_at("AT")
send_at("ATE1")
The issues I have with the code are that:
After sending an AT command (“AT” and “ATE1”), uart.read reads ‘b\x00’ and not the AT command. It looks like the SIM7020E module does not receive the AT command and does not respond to it (I should receive the response “OK”).
The “Read_buffer” function (see code below in picture 2) that reads the command in the buffer by sampling the UART returns an empty string.
Before sending the AT commands, I powered the module on and off to boot the modem using the Pin(14) of the SIM7020E module. When powered on, the module’s LED switches on so I know that my python code can communicate correctly and that the problem occurs for AT commands only.
Alternative 1:
I have tried typing AT commands ("AT" and "ATE1") directly on Putty (I did not hit Ctrl-C to break to the Python REPL), but I received an error message saying that Putty does not recognise the AT command (Picture 2: error with Putty)
Alternative 2:
I also tried using an AT command tester for Simcom modules from the website https://m2msupport.net/m2msupport/download-at-command-tester-for-simcom-modules/, but the software was unable to connect to the USB port (Picture 3: error from the AT command tester). It recognised the port but could not connect to it. The software asked me to try other baud rates and to enable flow control, so I tried all the possible different baud rates, and it did not work. For the flow control, I did not know how to configure it.
I do not understand why the module does not recognise the AT commands despite the other alternatives I tried and if it comes from a hardware or a software related problem. Do you know how I can make my module respond to AT commands?
It doesn't look like you are using the right serial interface in Putty. When you send your AT commands directly in Putty what is the COM5 port? It should be the COM port that shows up under the modem in the device manager.
I can't get local debug of IoT Edge modules working on VS Code, but part of the problem could be that I don't understand what I'm doing in the steps.
I'm following the Microsoft guide here. Can anyone explain to me when I run the command "Azure IoT Edge: Start IoT Edge Hub Simulator for Single Module" in VS Code, why do I need to pass an "input name"? Why doesn the simulator need to know this. I've got multiple input commands on my edge module and the fact I need to pass it is making me question what the simulator actually does. I want to be able to debug multiple inputs.
Also on the same documentation, I can't see how it defines which module I want to run in the simulator. Am I missing something or is the process confusing?
When you Start the IoT Edge Hub Simulator for a Single Module, you spawn two Docker containers. One is the edgeHub and the other is a testing utility. The testing utility acts as a server that you can send HTTP requests to, the requests specify the input name and the data. You can use this to send messages to various inputs on your module. Just looking at that, I understand why it is confusing to supply the input name to the simulator. But when you inspect the edgeHub container, you'll see the following environment values being passed:
"routes__output=FROM /messages/modules/target/outputs/* INTO BrokeredEndpoint(\"/modules/input/inputs/print\")",
"routes__r1=FROM /messages/modules/input/outputs/input2 INTO BrokeredEndpoint(\"/modules/target/inputs/input2\")",
"routes__r2=FROM /messages/modules/input/outputs/foo INTO BrokeredEndpoint(\"/modules/target/inputs/foo\")",
"routes__r3=FROM /messages/modules/input/outputs/input1 INTO BrokeredEndpoint(\"/modules/target/inputs/input1\")"
Just like on a real device, you need routes to talk to your module. The edgeHub container registers these routes with the values you supplied during the starting of the simulator. That input can be a comma-separated list. So if you are using more inputs, feel free to supply them when you start the simulator. Under the covers, that command runs:
iotedgehubdev start -i "input1,input2,foo"
Note: when I was testing this with the latest VS Code Extension, the first time I ran it, the textbox contained: "input1,input2".
I have been trying to locate a working library for the MSR605X magnetic card reader/writer. At time of writing, I have tried five separate libraries. Only two of these were explicitly for the 605X the other three were for the older 605. All the libraries I have tried either did nothing at all or errored before completing a command (can't figure out the errors either).
I am running Raspberry Pi OS 32 bit on a Raspberry Pi 3 B+ the MSR605X communicates via a USB connection.
So far the library that seems to be most complete is: https://pypi.org/project/msrx/
However, I can not get this library to read or write (either nothing happens or I get a Serial exception "cannot reconfig port).
Any help or links to documentation for this reader is welcome.
EDIT: Adding the commands ran with the above library
msrx -D /dev/input/event4 read
msrx -D /dev/input/jso0 read
The -D is to specify the device path (default is /dev/ttyUSB0 which doesn't exist on my system). I obtained the above two paths by searching for USB serial devices then matching the search result to the device ID which I obtained from lsusb.
Running these commands results in a serial exception (could not reconfig port) which I assume means that I have the wrong device path. I have also checked for any tty* device paths that are changed when I plug in the reader. I consistently get a permission denied error whenever trying to run the above commands with a tty* device path (I am root on this system).
msrx author here — MSR605 requires an external 9V power injected into its cable (via the barrel jack port), otherwise it won't power up properly.
I'm currently running Robotframework in Eclipse on Windows 10 OS. I'm using an external python library that allows students and teachers to use this extracted library to connect to our hardware devices. I'm automating the extractions from the main site package made by our developers. If more than one device is plugged into the USB ports on the PC, then the code does the following:
x = input("Select one device:")
selected = int(x)
This causes a terminal prompt so the user has to type in a 0, or 1 for example, then hit the ENTER key. User response will allow the code to further process a connect to the selected device. Note, this prompt is not a GUI. So when I run Robotframework, it will execute the steps up to the point where it's prompting.
It seems like this should be pretty easy, but I can't seem to figure it out. Since you're inside a piece of code that's waiting for input, how do you make RobotFramework do something with it?
Edit: It occurs to me that maybe there's a way to execute a delayed Robotframework step that starts an external python command after a specified time, to throw a '0' and a RETURN key response. I had a python file made from an import of pynput.py library which appears to work from the command line execution (prints a 0, or a 1, and a return line feed). There's gotta be an easier way I'd think, but I don't know what it is.
Edit: Can I run a keyword from a listener that watches for the command prompt and the keyword runs another python file to feed the prompt? If I get this to work, then all I have to do is leave the devices on the USB port (or hub for that matter), and select the devices I want to do further testing on. Our devices are supported Blooth tooth as well but I need to run both USB and BLE tests to verify our Python extractions the teachers and students can use.
Edit: The other option is to use a software programmable hub and select the USB with a specific device on it, but I'm trying to avoid that.
OK, I solved it using Robotframework background process. I wrote a small python file that gets executed from the process. It has a 5 second timer (more than I need) and then Robotframework runs the next Test Case step. The Python file then does some keyboard presses, selecting the port and an ENTER key which goes out to the console (feeding the input prompt). It connects the sensor.
So in my Robotframework Test Case I do the following:
*** Test Case ***
smoke_test
Start process . Python . usbportselect
open usb
The Python program called from the process looks like this:
import time
import pynput
from pynput.keyboard import Key, Controller
keyboard = Controller()
def choose_usb(portvalue)
keyboard.press(portvalue)
keyboard.release(portvalue)
keyboard.press(Key.enter)
keyboard.release(Key.enter)
time.sleep(5)
choose_usb('0')
Note: I'm pretty sure this won't fix all the problems with using processes, but it's at least a start and a way to feed input to a prompt resulted from a future Test Case step
I've finally created a Dissector for my UDP protocol in Lua for Wireshark, but the work flow is just horrendous. It consists of editing my custom Lua file in my editor, then double-clicking my example capture file to launch Wireshark to see the changes. If there was an error, Wireshark informs me via dialogs or a red line in the Tree analysis sub-pane. I then re-edit my custom Lua file and then close that Wireshark instance, then double-click my example capture file again. It's like compiling a C file and only seeing one compiler error at a time.
Is there a better (faster) way of looking at my changes, without having to restart Wireshark all the time?
At the time, I was using Wireshark 1.2.9 for Windows with Lua enabled.
The best way to automate this is by using command line. Yep, use tshark instead of loading gui thingy.
If your lua script is called "proto.lua" and it defines an protocol called "MyProto" that uses port 8888, you can test your dissector using:
tshark -X lua_script:proto.lua -O MyProto -V -f "port 8888"
-V option makes tshark print all the info of all protocols.
-O option filters the -V option to make it show all the info only on the listed(CSV) protocols.
-f option filters all packets that doesn't conform to the rule. In this case any packet that is not from the right port.
The latest Wireshark release comes with a primitive console for running lua script. It can be found under Tools -> Lua -> Evaluate. From there, you should be able to reload your dissector by running dofile(). You'll also have to remove the previous version of your dissector.
Here's an example for a TCP-based dissector.
local tcp_dissector_table = DissectorTable.get("tcp.port")
tcp_dissector_table:remove(pattern, yourdissector)
yourdissector = nil
dofile("c:/path/to/dissector.lua")
I recommend placing this code in a function inside your file.
Now there's a problem with this answer: If your script created a Proto object, it seems that you can't create it again with the same id. The constructor for the Proto class calls the C function proto_register_protocol() (see epan/wslua/wslua_proto.c). I can't find any lua function that will unregister the protocol. In fact, I can't even find a C function to unregister it.
You might be able to write a trivial wrapper function that Wireshark loads, and have it just load the real file from disk (e.g. via dofile()). This could probably "trick" Wireshark into always reloading your Lua code until you're more comfortable with it and can remove this hack.
I've been facing the same problem for quite a while, so I have decided to create a tool that would help me streamline that "horrendous workflow". The tool in question is Wirebait. It is designed to let you run your Lua dissectors as you write them without Wireshark.
It is very quick and easy to install and use. All you have to do is load the Wirebait module and add a five liner snippet on top of your dissector script. Then if you use an IDE such as ZeroBrane Studio, Wirebait allows you to literally write and debug your code on the fly, no need for wireshark. If you don't even have a pcap file, you can use a hexadecimal string representing the data you want to dissect.