Comments (16)
Heh, I was just writing a reply to close this.
Producing an image for a static result seems a nice idea, but the cropping is very annoying.
Perhaps a static GIF would avoid this? At least the old animated GIF output wasn't cropped like this AFAICR, though maybe twitter has changed, or perhaps it handles animated and static GIFs differently.
from bbcmicrobot.
Another issue here is that any audio is now lost if a PNG image is generated. I have a working fix for that, but I need to sort out test cases.
It also avoids pointlessly encoding a silent audio stream into the video, which gives a smaller video for such cases (which seem to be the majority of tweets).
from bbcmicrobot.
Rather than try to find out, I just rewrote the code to avoid using external commands for this (#10).
from bbcmicrobot.
Hah! You're a little quicker than I expected - yes I uploaded to this repo with the PNG enhancement in there - but have not created an action to auto deploy yet. The live version is behind right now but I will keep in sync'ed in future.
from bbcmicrobot.
@ojwb I've sync'ed the live version now and had the bot re-run that tweet. Here's the PNG output.
https://twitter.com/bbcmicrobot/status/1272367497623171072
An aside. I'm not totally sure I like the fact that Twitter seems to crop a letterbox timeline preview of the PNG - this doesn't happen to video.
from bbcmicrobot.
Good idea a 2 frame animated GIF could work. The original reason for the PNG is some static 'hi res' MODE 0 graphics appear blurred in the timeline in the video preview, I was trying to avoid that.
from bbcmicrobot.
We should see how the PNG goes. Might be GIF is better. Need to test.
from bbcmicrobot.
We should see how the PNG goes. Might be GIF is better. Need to test.
I tried making a GIF via "try" with the obvious code tweak to see how it looks in the timeline but twitter won't let me tweet it with the uselessly vague error:
Something went wrong, but don’t fret — let’s give it another shot.
from bbcmicrobot.
Do you have a Twitter Dev account + created a new app + put the API keys for the app in the BBC Micro Bot .env? If so perhaps Twitter prefers a GIF to uploaded via simple Media Upload method https://developer.twitter.com/en/docs/tutorials/uploading-media
from bbcmicrobot.
I have/did none of those things!
I just tried to attach the GIF to a tweet via the web UI (since I thought that would show if it got a letterboxed preview in the timeline, and if it did I could then try with a 2 frame GIF to see if that was treated better). But twitter wasn't letting me post it for unclear reasons.
from bbcmicrobot.
A smaller GIF (with 2 frames, both the same) seems to get shown in full: https://twitter.com/rheolism/status/1272780741110165504
from bbcmicrobot.
Cool. We need a dev twitter account you can access programmatically I will get it sorted this weekend
from bbcmicrobot.
Thread summary: The PNG isn’t being generated for static image without audio as it should. And it should probably generate a 2 frame GIF anyhow
from bbcmicrobot.
It seems that behind the scenes twitter actually converts a GIF to a video and serves that instead. I suspect the rejection of a static GIF is probably that video conversion step failing.
But that may mean that GIF isn't any better for avoiding the blurred MODE0 graphics issue, because twitter's conversion will reintroduce that problem.
I'm not sure why PNGs aren't being produced though. Perhaps my "cmp with /dev/zero" trick doesn't give the expected output on the live machine and so it thinks there is audio?
from bbcmicrobot.
The cmp
trick might be the problem. Production is running on AWS EC2 / Amazon Linux AMI... CentOS like? Some commands differ eg shasum
becomes sha1sum
from bbcmicrobot.
This works fine now. Whether we want to switch from PNG to GIF is another issue
from bbcmicrobot.
Related Issues (12)
- bbcmicrobot handle not removed when CAPS used? HOT 5
- Tokenize parse error kills client HOT 2
- CI with test fails reported as passing HOT 1
- Handling of MODE7 colour blending HOT 4
- GXR and beebjit HOT 12
- Reduce start latency to match owlet HOT 2
- User Guide review HOT 2
- Stop loading DFS
- URLs npm prefers to use for jsbeeb break CI HOT 25
- Strip mastodon tags and mentions properly
- Emulator stops when focus switches away from tab HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bbcmicrobot.