Code Monkey home page Code Monkey logo

Comments (16)

ojwb avatar ojwb commented on June 4, 2024 1

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.

ojwb avatar ojwb commented on June 4, 2024 1

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.

ojwb avatar ojwb commented on June 4, 2024 1

Rather than try to find out, I just rewrote the code to avoid using external commands for this (#10).

from bbcmicrobot.

8bitkick avatar 8bitkick commented on June 4, 2024

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.

8bitkick avatar 8bitkick commented on June 4, 2024

@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.

8bitkick avatar 8bitkick commented on June 4, 2024

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.

8bitkick avatar 8bitkick commented on June 4, 2024

We should see how the PNG goes. Might be GIF is better. Need to test.

from bbcmicrobot.

ojwb avatar ojwb commented on June 4, 2024

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.

8bitkick avatar 8bitkick commented on June 4, 2024

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.

ojwb avatar ojwb commented on June 4, 2024

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.

ojwb avatar ojwb commented on June 4, 2024

A smaller GIF (with 2 frames, both the same) seems to get shown in full: https://twitter.com/rheolism/status/1272780741110165504

from bbcmicrobot.

8bitkick avatar 8bitkick commented on June 4, 2024

Cool. We need a dev twitter account you can access programmatically I will get it sorted this weekend

from bbcmicrobot.

8bitkick avatar 8bitkick commented on June 4, 2024

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.

ojwb avatar ojwb commented on June 4, 2024

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.

8bitkick avatar 8bitkick commented on June 4, 2024

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.

8bitkick avatar 8bitkick commented on June 4, 2024

This works fine now. Whether we want to switch from PNG to GIF is another issue

from bbcmicrobot.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.