[Csnd] my first YouTube upload
| Date | 2013-04-15 00:46 |
| From | Adam Puckett |
| Subject | [Csnd] my first YouTube upload |
Hey list,
I've finally arrived! (sort of). I've uploaded a YouTube video, using
only command-line tools and programming languages.
The video is here:
https://www.youtube.com/watch?v=qrzu1mxG5vQ
How to Do It Yourself:
1) Write a WAV file using your favorite language (e.g., Csound,
Python's wave module, etc)
2) Write an RGB24 video stream. In Python you would do:
write(struct.pack('BBB', r, g, b))
I did it with 3 nested loops: one for fps, one for width and one for height.
3) Tell FFmpeg you want to compress a WAV file and an RGB24 file into
a WebM container:
ffmpeg -i audio.wav -f rawvideo -s WxH -pix_fmt rgb24 -r fps -i
video.rgb compressed.webm
where:
W, H = width, height as integers
fps = frames per second
Enjoy!
Adam
|
| Date | 2013-04-15 07:15 |
| From | Oeyvind Brandtsegg |
| Subject | Re: [Csnd] my first YouTube upload |
Congratulations, Adam! Oeyvind2013/4/15 Adam Puckett <adotsdothmusic@gmail.com> Hey list, -- Oeyvind Brandtsegg Professor of Music Technology NTNU 7491 Trondheim Norway Cell: +47 92 203 205 http://flyndresang.no/ http://www.partikkelaudio.com/ http://soundcloud.com/brandtsegg http://soundcloud.com/t-emp |
| Date | 2013-04-15 13:05 |
| From | zappfinger |
| Subject | [Csnd] Re: my first YouTube upload |
Hi Adam, Could you share the Python code? regards, Richard -- View this message in context: http://csound.1045644.n5.nabble.com/my-first-YouTube-upload-tp5721959p5721967.html Sent from the Csound - General mailing list archive at Nabble.com. |
| Date | 2013-04-15 17:07 |
| From | Adam Puckett |
| Subject | Re: [Csnd] Re: my first YouTube upload |
Richard (and everyone else interested),
The Python code uses the wave module, which accepts packed struct
strings as data to write to a file. This was also how I wrote the RGB
data.
To write a 44100 hZ wave file:
import wave, struct
from math import sin, pi
w = wave.open('file.wav', 'wb')
w.setframerate(44100) #sample rate
w.setsampwidth(2) # 16bit
w.setnchannels(2) # stereo
for i in range(2): # loop through channels
for i in range(44100*60*4+44100*33):
w.writeframes(struct.pack('h',0))
w.close()
Writing RGB data for the video stream was as simple as:
image_file = open('video.rgb', 'wb')
fps = 30 # set frame rate
width, height = 1440, 1080
num_frames = fps*60*4+fps*30
for i in range(num_frames):
for j in range(width):
for k in range(height):
image_file.write(struct.pack('BBB', 0,0,0) # black video
(The resulting RGB is huge!!!!!!!!!!)
And I'm sure you all could come up with much more imaginative video
algorithms than I did. :)
Enjoy, and stay tuned!
Adam
On 4/15/13, zappfinger |
| Date | 2013-04-15 17:15 |
| From | Dave Seidel |
| Subject | Re: [Csnd] my first YouTube upload |
Hi Adam, is it supposed to be just one second long, with no visuals and a single beep? - Dave On Sun, Apr 14, 2013 at 7:46 PM, Adam Puckett <adotsdothmusic@gmail.com> wrote: Hey list, |
| Date | 2013-04-15 21:30 |
| From | David Mooney |
| Subject | Re: [Csnd] my first YouTube upload |
All I get is a short beep--no image. Lasts about two seconds. --David MooneyOn Sun, Apr 14, 2013 at 7:46 PM, Adam Puckett <adotsdothmusic@gmail.com> wrote: Hey list, -- Opaque Melodies http://opaquemelodies.com |
| Date | 2013-04-15 22:52 |
| From | andy fillebrown |
| Subject | Re: [Csnd] my first YouTube upload |
Adam is blind so the video itself is not what is important. The fact that Adam did it with nothing but the command line is what is important. He has been working on doing this for some time and he has now succeeded. Congratulations, Adam! Cheers, ~ andy.f On Mon, Apr 15, 2013 at 4:30 PM, David Mooney <dmooney023@gmail.com> wrote:
|
| Date | 2013-04-15 22:56 |
| From | andy fillebrown |
| Subject | Re: [Csnd] Re: my first YouTube upload |
Hi Adam, If you are planning on making more videos using a single black image, take a look at this question and answer
This will enable you to generate all the frames for the video using one image file instead of a file for each frame. Cheers, ~ andy.f
On Mon, Apr 15, 2013 at 12:07 PM, Adam Puckett <adotsdothmusic@gmail.com> wrote: Richard (and everyone else interested), |
| Date | 2013-04-16 00:58 |
| From | Adam Puckett |
| Subject | Re: [Csnd] Re: my first YouTube upload |
The video wasn't important for this little test, but eventually I do plan on writing algorithmic animations. Not only was it important that I do it entirely from the command line, but also that I do it without any real-world signals. Thanks for all your feedback! On 4/15/13, andy fillebrown |
| Date | 2013-04-16 02:38 |
| From | andy fillebrown |
| Subject | Re: [Csnd] Re: my first YouTube upload |
In that case I recommend writing your image files in the .png file format. An example can be found at http://code.activestate.com/recipes/577443-write-a-png-image-in-native-python/ The resulting image files will be much smaller and easier to work with. Cheers, ~ andy.f On Mon, Apr 15, 2013 at 7:58 PM, Adam Puckett <adotsdothmusic@gmail.com> wrote: The video wasn't important for this little test, but eventually I do |
| Date | 2013-04-16 04:07 |
| From | Adam Puckett |
| Subject | Re: [Csnd] Re: my first YouTube upload |
Or perhaps I could stream the raw RGB over HTTP using the loopback. Why didn't I think of that before?! And now that I think about it, I could go all SC and stream the WAV over a different HTTP port (assuming I can do that...?). Plunging further into the depths... BTW I showed this to my communications class at college and they all liked it. On 4/15/13, andy fillebrown |
| Date | 2013-04-18 04:42 |
| From | Kelly Hirai |
| Subject | [Csnd] testing |
testing. 1,2,3. |