Using python scripts in GNURadio blocks?

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?

-----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 J. 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 [email protected]
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-----

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs