Offline

There seems to be a myriad people trying to do live databending. Well here i show I did it.

ffmpeg -f video4linux2 -s 320x240 -i /dev/video0  -f rawvideo -pix_fmt rgb32 -s 320x240 - | sox -r 482170 -e u-law -t raw /dev/stdin -t raw /dev/stdout echo 0.8 0.88 60 0.4 | ffmpeg -f rawvideo -s 320x240 -pix_fmt rgb32 -i - -f avi - | mplayer - -cache 150 -fps 60

The first ffmpeg reads from the webcam and reformats it to raw rgb32. The output is piped into sox where an echo effect is applied to bend the raw image data. The output is then reformatted by the next ffmpeg call into an AVI. The result is played by mplayer with a FPS fast enough to keep up with the extra (I guess here) output from the echo effect. If mplayer plays too slowly, the video will slow down over time and eventually freeze.

Disclaimer: I am new to this so am struggling to keep up with what I am doing. Sometimes I hack first and ask questions later.

Last edited by Danimalia (Mar 2, 2013 9:42 pm)

Offline
rochester, ny

can you explain this slower for me

Offline

I can't tell if you're trolling or not, because my explination is legitemately confusing as all hell.

[EDIT]

My apologies. I have explained it further down.

Last edited by Danimalia (Mar 2, 2013 9:40 pm)

Offline
canada

i doubt that he would be trolling he is a nice man.

Offline
IL, US

yeah, that man is unlikely to be trolling

Offline
Murcia, Spain

Yes, I didn't get that either...

Offline
Medina, Ohio

I think he is trying to say that:

ffmpeg -l vidToData -q 640x360 -ImmaG /dev1/sda3/v6  -h rawMeatVideo -pic_fORmAt HSV32 -h 640x360 - V|H|S socks -r #233665 -f u-law -new rawMeatVideo /dev1/sda3/Out -h rawData /dev1/stdout echo 1.8 5.88 63 1.4 | ffmpeg -G rawMeatvideo -H 640x360 -pic_fORmAt HSV32 -i - -f avi - | mplayer - -cache 150 -fps 5000

Offline

hehe, new here and paranoid.I'll try to explain better. I am terrible at explaining things, so bare with me!

The principle is simple.

1. Capture video from the web cam and change the video format. This is the first ffmpeg call.
2. Play makebelieve and modify it like audio. This is the sox call.
3. Turn it into a more standard video format. This is the second ffmpeg call.
4. Play it with mplayer.
5. Enjoy.

To transfer the data from each program, I use pipes. Each program reads from stdin and writes to stdout.

Let's look at the commands a bit closer now. Some of the arguments are unnecesary. This is a really rough hack. I still need to refine it as I learn more.

1. ffmpeg -f video4linux2 -s 320x240 -i /dev/video0  -f rawvideo -pix_fmt rgb32 -s 320x240 -

"-f video4linux2 -s 320x240 -i /dev/video0 " reads from the webcam and makes the size 320x240.
"-f rawvideo -pix_fmt rgb32 -s 320x240" reformats the video to be raw RGB data. This means that there will be no header to mess up.
"-" write to standard out

2. sox -r 482170 -e u-law -t raw /dev/stdin -t raw /dev/stdout echo 0.8 0.88 60 0.4

Some of this is magic to me. We set the sample rate fairly high, tell sox to treat it like raw audio data, read from stdin, write to stdout, apply an echo effect. The arguments to the echo effect were copied and pasted from elsewhere.

3. ffmpeg -f rawvideo -s 320x240 -pix_fmt rgb32 -i - -f avi -

Convert from raw RGB data to an AVI. This step will be unnecisary if I can get mplayer to play the RGB data.

4. mplayer - -cache 150 -fps 60

Play it. I set the framerate higher than was recorded (30 on my system) so that any extra data that sox may produce from echoing will be read and not pile up.

5. Enjoy (and piss off a nice forum member, apparently)

Sorry!

Offline

Okay. Came up with something simpler. I combound step 3 and 4. Mplayer now just reads the raw RGB data. Recrd, modify, playback.

ffmpeg -f video4linux2 -s 320x240 -i /dev/video0  -f rawvideo -pix_fmt rgb32 - | sox -r 482170 -e u-law -t raw /dev/stdin -t raw /dev/stdout echo 0.8 0.88 60 0.4 | mplayer -demuxer rawvideo -rawvideo w=320:h=240:format=rgb32 - -fps 30

Last edited by Danimalia (Mar 7, 2013 11:52 pm)

Offline
ad-hell-aide

Interesting.

Are you able to post an example input v output or something?

Offline
BOSTON8BIT, MA
Danimalia wrote:

There seems to be a myriad people trying to do live databending.

Is there some sort of community specific to this sort of thing? Because I'd like to be keeping up with it, seeing as I just got access to Max 4 Live for the first time...