question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

write a Image object into std.in buffer

See original GitHub issue

I’m working on streaming image sequences into ffmpeg. Roughly, this is my code:

image_original = pyvips.Image.new_from_file(self.file_path)

p = Popen(['/usr/local/bin/ffmpeg', '-y', '-f', 'image2pipe', '-vcodec', 'mjpeg', '-r', self.fps, '-i', '-', '-r', self.fps, '-f', 'mp4', '-vcodec', 'libx264', '-crf', '26', 'output/{}.mp4'.format(self.animation_name)], stdin=PIPE)

for image in images:
    image.smartcrop(self.output_raster_width, self.output_raster_height)
    image.jpegsave(p.stdin, profile='JPEG')

p.stdin.close()
p.wait()

This yields an error, but I suspect I’m not using the right method to do the sdtin write. Is there a good way to handle this use case?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
jcupittcommented, Nov 6, 2017

Hi again, do you mind if I close this issue? It’s confusing having two open for almost the same thing. Let’s continue discussion in the other one.

0reactions
marcrleonardcommented, Nov 6, 2017

Hey John, just played off this in the other thread 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

how to get buffer from Imagemagick image in c++
I am only able to write in file. Tried using Magick::Blob but still of no use. Following code is used to load, convert...
Read more >
Python PIL | Image.frombuffer() method - GeeksforGeeks
PIL.Image.frombuffer() Creates an image memory referencing pixel data in a byte buffer. Note that this function decodes pixel data only, not ...
Read more >
Import Pixel Buffer Into an Image — v5.3.0 - ITK examples
Here we create a synthetic image with a centered sphere in a locally allocated buffer and pass this block of memory to the...
Read more >
ImageOutput: Writing Images - Read the Docs
Here is the simplest sequence required to write the pixels of a 2D image to a file: ... std::unique_ptr<ImageOutput> out = ImageOutput::create (filename);....
Read more >
IO extensions - Boost.GIL documentation
std ::string filename( "image.tif" ); rgb8_image_t img( 640, 480 ); // write ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found