discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] Using python scripts in GNURadio blocks?


From: Marcus Müller
Subject: Re: [Discuss-gnuradio] Using python scripts in GNURadio blocks?
Date: Mon, 14 Apr 2014 08:59:41 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Jordan,

ok, there's two questions here:
1. Can I run arbitrary python code as block?
2. How do I use external programs in a block? (ffmpeg and the
transcode tools are not python modules but executables on their own)

So there's two answers here:
1. That's exactly what a python block is. Follow the "how to write an
out-of-tree module" guide in the GNU Radio wiki. Just fill in your
functionality in the work method.
2. This gets a little trickier. Since these programs are external, you
can't rely on them giving you a fixed amount of output per input.
Usually, they work on complete files -- which is quite the opposite of
what's the idea behind GNU Radio. Two ideas:
a.) (if the used program allows you to stream data into it using
stdin) use the python subprocess module to start the program and pipe
samples into it. Block the work() until you get sufficient output from
the process. This is a hack and has lots of downsides.
b.) see if you can find the functionality wrapped for python (I don't
think there is a working python binding for ffmpeg right now,maybe
there are bindings for libav, maybe use gstreamer or so). Use that.
If python bindings don't exist, instead of writing a python block,
write a C++ block.

Greetings,
Marcus


On 14.04.2014 04:58, Jordan Johnson wrote:
> I have a flow graph where I'd like to run ffmpeg/avconv, and
> tscbrmux as blocks. Is there a way to use FFMPEG and other scripts
> as GRC blocks?
> 
> 
> 
> _______________________________________________ Discuss-gnuradio
> mailing list address@hidden 
> https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
> 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJTS4ddAAoJEBQ6EdjyzlHtzVIH/jp56DjBLyzjH46J2FExUYMG
EkP8m3cQ16M4SxVCVr3agwasqgnROSTylKZbsUAUoigsJo6eJ4Vqvqp/0EfRoL0M
yNA1H12L+9TFRZ1F1J/85XxnDT9kgYc7MsJlINySiy3ilag0dzP59GbAdh23X5N/
KjPSDneYZhlmACOaR58JvoN1czNLOlDQYOQyVA8O8riZZnwzibmhUCS/dlhz1yST
YJ04Yp8OgtREENYzIwbH2rclxo3dRpdSSA2x81MT2C+icH3tFkRbkfXdrOW7d0lC
9E/qVeho98VGLWjGwASXwxpumwfmS/qeG+Iz/ijB9PPNHrLqzPg6ZwgRI0nfgXs=
=Y00L
-----END PGP SIGNATURE-----



reply via email to

[Prev in Thread] Current Thread [Next in Thread]