CasparCG lower third super machine with Livecode

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
bern333
Posts: 25
Joined: Tue Aug 02, 2016 11:03 am

CasparCG lower third super machine with Livecode

Post by bern333 » Sun Aug 14, 2016 5:43 pm

When the university where I do a bit to help discovered that a commercial lower thirds machine would cost at least £12000 I started looking at the forums etc for a CasparCG client to do the job. I've failed to find what I need - a straightforward simple to use client that puts lower thirds on and off, and is simple enough to use for those who neither know nor care what CasparCG is, and just want to get something on the screen. It may be out there, but I couldn't find it.

So I decided to have a go at writing a client. I chose Livecode because as I was doing the job for free I could have Livecode for free. I hadn't used it before, but it sells itself on being a user friendly system that uses ordinary language to make things happen. That isn't terribly true - if you put the word "the" in somewhere it shouldn't be you'll get the most obscure error message. Likewise the other way around.

Anyway, after several weeks of fiddling around - and help from here - I got what I think is something that's user friendly enough to give to the university. As I got through the various stages - info into the database, edit info as required, info onto the screen, I realised that I now have the basic Livecode for any CasparCG operation, and I expect that the uni will gradually find many more uses for CasparCG now that we have a friendly client.

So, for all those out there who need the same as me, I've put v0.9 beta here
http://tech-ops.co.uk/bern/titler/
There's the Livecode project, a windows exe and various bits and pieces. No support, no warranty, GPL etc etc. I hope it helps somebody out there

Bernard Newnham August 2016
Last edited by bern333 on Sun Aug 14, 2016 10:23 pm, edited 1 time in total.

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: CasparCG lower third super machine with Livecode

Post by Klaus » Sun Aug 14, 2016 6:01 pm

Hi Bernard,

congratulation! :D

Maybe you could give us non-video-folks a short explanation what "lower thirds" means in this context?
Thanks!


Best

Klaus

bern333
Posts: 25
Joined: Tue Aug 02, 2016 11:03 am

Re: CasparCG lower third super machine with Livecode

Post by bern333 » Sun Aug 14, 2016 10:22 pm

Image

It's the strip at the bottom. A pre-built Flash template provides the background, animation, layout, and font used in the programme. The client provides the actual text, which of course is different every time, and the triggers to take the lower third on and off. Used by tv organisations from the smallest to the largest all over the world.

The client can also send the command to choose the "static bars" jpg to send to the CasparCG background output.

B

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: CasparCG lower third super machine with Livecode

Post by Klaus » Mon Aug 15, 2016 10:43 am

AHA! :D
Thank you very much for this info!

capellan
Posts: 654
Joined: Wed Aug 15, 2007 11:09 pm

Re: CasparCG lower third super machine with Livecode

Post by capellan » Mon Aug 15, 2016 9:20 pm

Amazing! Congratulations Bernard :D

This is the kind of project that many years ago would required
a Commodore Amiga with a Video Toaster Card.

Are you planning to extend the capabilities of your program?
I am sure that many developers would find really useful
that you wrote about the most difficult and the most
easiest tasks to code in your progran.

Have a nice week!

Alejandro

bern333
Posts: 25
Joined: Tue Aug 02, 2016 11:03 am

Re: CasparCG lower third super machine with Livecode

Post by bern333 » Tue Aug 16, 2016 8:17 pm

Having conquered the basics, I've got started on more variations. Currently you can only use one template, but I'm writing the bit that allows you to choose from any that are loaded. Also, if you can play a graphic you can play a clip, or group of clips. So, yes, I'm extending

B

bern333
Posts: 25
Joined: Tue Aug 02, 2016 11:03 am

Re: CasparCG lower third super machine with Livecode

Post by bern333 » Thu Aug 18, 2016 9:58 pm

capellan wrote: I am sure that many developers would find really useful
that you wrote about the most difficult and the most
easiest tasks to code in your progran.
Ok - well you asked......

What's good - it's a comprehensive language which does the job I need to do and it's free for people like me.

I have a love hate relationship with "drop an object, write some code" systems. When I've tried before I've always got lost - "where's the code for this stuff, can't find it ", but this time I've persevered. I'm not totally new to programming. Although I was a tv producer at the BBC I wrote a presentation scheduling system in an old software called Smartware. It ran several BBCtv channels for nine years, 24 hours a day. More recently I wrote a logging and payment system for a flying club, in use now every day for eight years. That was written in HTML5, PHP and SQL.

Which gives context to "what's bad?". My job is to tell people stories in a clear and simple way, so that they can understand and maybe enjoy whilst eating dinner or whatever. What's wrong with Livecode is what's wrong with other programming languages, but with less excuse.

Documentation, or rather lack of it!

The Livecode sales model is - I assume - to give people the chance to play for free, and and then they pay for a licence so that they can make money. Very good. But in order to grab and hold a customer - like maybe me - you need to help them along. A lot in the early stages, less perhaps later. Explaining stuff to the customers is the most important thing you can do to keep them as customers.

Examples -

A major problem for me - I wanted to send a complex string including this "<data id=\"text\" value=\"Bernard Newnham\"></data> </componentData><componentData id=\"f1\">" to a server via a socket. So I put the string together in a variable. No matter what I did, it threw an error. I looked around, and found that I was far from the first to have the problem, but there were no answers. After some days I asked here, and a nice lady told me that you have to put that sort of stuff in a field. Not totally obvious (at all!) to anyone new, and not at all intuitive. This level of info should be in lesson 1.

Another problem I've had, and just solved this evening, is that Livecode sometimes likes to put a linefeed character invisibly on the end of a string. So when I sent a command to CasparCG it had LF/CR/LF, instead of CR/LF, and nothing happened - except an error message from CasparCG. There are a good number of reasons why CasparCG might not want to play a clip, so it's taken me a long time to solve the problem. The info was in an "oh, by the way..." on some site or other. Getting rid of the unwanted character was yet more fun. Here you go -

Code: Select all

put replaceText(field tString,"[^\w\d.\n]", empty)  into field "tMedia"
Keeps numbers, letters, punctuation etc but gets rid of other stuff like line feeds.

Livecode lessons - a large chunk of the website material - spends a lot of time saying "you can do this" without actually telling you how. and one I've kept coming back to is one about sockets, which very quickly jumps from the very basics to "look, I can write a chat server system". Well, good for you, but you missed out all the stuff I need to know. I looked in the dictionary but it isn't there either. So I was reduced to hunting the forums, trying out stuff that I found in the hope that something might work. I still don't know definitively how to arrange a read command, but what I've got works. Also, I can't find a sensible way of reading and dumping stuff stuff i don't want, like "200 Play OK". which sits in the buffer till you read, and then gets in the way.

What else? The datagrid examples worked a treat. I haven't the faintest idea how it works, but I now have three of them, all doing what they supposed to do. Well done the person who wrote that stuff.

And that's it - for now.

Once again - good documentation keeps your customers and makes you money, said the person who made BBC on air trails for ten years.

B

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: CasparCG lower third super machine with Livecode

Post by jacque » Sat Aug 20, 2016 4:51 am

A major problem for me - I wanted to send a complex string including this "<data id=\"text\" value=\"Bernard Newnham\"></data> </componentData><componentData id=\"f1\">" to a server via a socket. So I put the string together in a variable. No matter what I did, it threw an error. I looked around, and found that I was far from the first to have the problem, but there were no answers. After some days I asked here, and a nice lady told me that you have to put that sort of stuff in a field. Not totally obvious (at all!) to anyone new, and not at all intuitive.
Just so others don't think the field is required -- you could have built the string in a variable. It was just easier to use a field or (my preference) a custom property. The reason is that you can type the exactly what you need only once and then copy it into a variable without all the quotes and ampersands and punctuation required to build it on the fly. But you could have. So, since a field or property isn't really required, it isn't in any lesson. The technique was just a shortcut to make things easier.
put replaceText(field tString,"[^\w\d.\n]", empty) into field "tMedia"
That's one way. I would have just done this:

Code: Select all

 replace LFCRLF with CRLF in tString
It's interesting though to see how you've progressed and what tripped you up. Until one knows the entire language and all the little tricks, it can be difficult to know exactly where to start and what is needed. I think you've done a fantastic job. There are multiple ways to do things in LiveCode and no one method is better than another, it all just depends on how your code is written and what is needed at that point. That's one reason it's hard to create lessons that cover every situation. About all one can do is give generic advice and explain clearly all the different commands and functions that are available. After that it's up to the programmer to figure out how to arrange it all -- and there's always us, here in the forums, to help.

Which we're happy to do, and I'm delighted you're on your way.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

capellan
Posts: 654
Joined: Wed Aug 15, 2007 11:09 pm

Re: CasparCG lower third super machine with Livecode

Post by capellan » Sat Aug 20, 2016 6:00 am

Hi Bernard,

Bernard wrote:
> What's wrong with Livecode is what's wrong with other programming languages, but with less excuse.
> Documentation, or rather lack of it!
> The Livecode sales model is - I assume - to give people the chance to play for free, and and then they pay
> for a licence so that they can make money. Very good. But in order to grab and hold a customer - like maybe me -
> you need to help them along. A lot in the early stages, less perhaps later. Explaining stuff to the customers is
> the most important thing you can do to keep them as customers.

Well, I suspect that lack of documentation in some key areas is because LiveCode uses many standard libraries
that works like other platforms (for example Regular expressions) and the developers should already know or
discover these other tutorials, docs or books...

Probably, I'm wrong about this but it's my personal theory that explains the lack of docs in certain specific areas of LiveCode.

By the way, the name "Regular Expressions" is very misleading... a name like "HyperMegaUltra Expressions" could have been more catchy... :D

About this code: put replaceText(field tString,"[^\w\d.\n]", empty) into field "tMedia"
I want to know if he could just use this code: delete last char of field "tMedia"

bern333
Posts: 25
Joined: Tue Aug 02, 2016 11:03 am

Re: CasparCG lower third super machine with Livecode

Post by bern333 » Sat Aug 20, 2016 11:21 pm

It's interesting to read comments on my comments!

I think there are probably an awful lot of people who pop into different skills to get a job done. Maybe they stay longer and learn more, or maybe they just get one thing done and go. I must admit that for most things I'm a passer-through. I know Photoshop enough to do what I need and the same with Premiere Pro. This is a really good thing because the Adobe documentation is truly horrendously bad. You almost always have to hunt the forums, and you always find everyone has been that way before. You can usually tell when Google auto-completes your search request.

Livecode isn't Adobe, and it would seem to me that it's in the developers interests to make things easy for beginners. I've found common things now in trying to learn enough about a number of programming languages. For instance, lots of people love to show off their skills. So a basic primer in - say - strings handling - will tell you simple stuff, then suddenly leap ahead, and people like me are instantly lost. The books are full of examples - chapters one to four explain what variables are - or whatever - and chapter five shows how to write software for the Large Hadron Collider. Do any normal people ever proof read this stuff?

New users pretty much always want to do similar things, and I find that each time I've tried to do things in the various programming languages I've been generally attempting to do what I regards as the basics. Put something in here, get it out there. Put a button on the screen, get it to do something. I really don't need several pages detailing the wonderful ways I can change the colour and shape of the button, I need those pages to explain the basics of the code under the button. In the case of Livecode it seems to be a company rather than a loose group of developers (PHP, Javascript). They need people to stay and pay so that they get paid. They don't want people to give up and wander off disillusioned. So they need a comprehensive get things going tutorial system for newcomers. And they need to have it proof read by idiots - well maybe not idiots, but people who are eager but completely ignorant. I proved my flight logging system by getting the oldest member of the flying club who wasn't in any way a computer person to sit in front of the and give it a go. "Bernie, you know I don't understand this stuff" - "Brian, you've just been flying, you have your times and places, see what you can do". So I watched and learned, and Brian went through the system, and mostly it worked. Where he faltered, I changed it.

Meanwhile on TitleCG, I've embraced Custom Properties to pass info round the various cards, I've got CasparCG to play clips and accept different Flash templates for the lower thirds - especially now I can get rid of the LF I didn't know was there. Jacqui has a much simpler way to do that job than the regular expression, but I don't know nearly enough about the language syntax to have put that together myself. It was difficult enough to find the right references to show that Livecode actually does regex and how it does, quite apart from the actual expression itself. So the thing is expanding, just because I can make it do so, and its an interesting challenge - but I've love to have a proper beginners book or website that didn't suddenly feel the need to show what wonderful things the author can do.

B

Post Reply