How to convert WebP formatted images in Tahrpup?

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

How to convert WebP formatted images in Tahrpup?

#1 Post by MochiMoppel »

My private edition of MMview supports a couple of image formats not (yet) supported in the posted version, and one of them is WebP.

It is easy to convert a WebP image to JPEG with ffmpeg:

Code: Select all

ffmpeg -i input.webp output.jpg
I've learned that ffmpeg is not installed in Tahrpup, so how could this be done in this and other distributions that replaced ffmpeg with avconv? I've already tried avconv, but no dice :cry:

[Edit]: Cleared Fatdog's name.

.
Last edited by MochiMoppel on Tue 05 Dec 2017, 13:23, edited 2 times in total.

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#2 Post by musher0 »

Hello MochiMoppei.

Good to see you are working on a new project! :)

In answer to your question:

Google itself has some tools for coding and decoding webp images:
https://developers.google.com/speed/webp/download

I have assembled those tools into a pet, libwebp-0.6.1-linux-x86-32.pet, available
here for the next month: http://www43.zippyshare.com/v/jAcl4HY9/file.html

Also, some webp images may be converted with imagemagick. Please see
answer # 31 on this page:
https://unix.stackexchange.com/question ... ebp-to-jpg

I had no problem viewing the webp original images on the Google developers' page:
https://developers.google.com/speed/webp/gallery1 in my old opera 12.16.
I could have taken a snapshot with SFR's Take-a-Shot or similar to obtain a jpg.

I have successfully used the dwebp utility (from the Google package mentioned
above) to convert image 2.webp on that page to png. This png image can then be
loaded in Puppy's mtpaint for further process.

I have used this dwebp utility on xenialPup. It appears to be "distro-agnostic", but
you and / or other Puppyists may wish to confirm that it can run on other Puppies
than the xenialPup.
.
IHTH.
Attachments
dwebp-help.jpg
The 1st option below ( -pam ) can be interesting for Puppyists, because most
Puppies have the pam and pbm image processing utilities.
(142.84 KiB) Downloaded 750 times
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#3 Post by 01micko »

@musher0, I think mochimoppel wants to use what's there already.

But I don't know what's in pups that i haven't used or built but hopefully x264 is there so it can decode a .webp file. I created a file and then took a screenshot in mplayer. Maybe VLC, Xine or MPV can do similar to this.. (my input webp file is '1.webp' and i output to zz.mkv.. use what out format your vpx can support. '1.webp' I used is available from http://www.gstatic.com/webp/gallery/1.webp).

Code: Select all

x264 -o zz.mkv 1.webp ; mplayer -frames 1 -vo jpeg:outdir=/root 1 zz.mkv
Direct the output file wherever but _my_ mplayer defaults to '00000001.jpg'.
Puppy Linux Blog - contact me for access

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#4 Post by MochiMoppel »

musher0: Thanks. I'm aware of the tools you mentioned but I doubt that they are shipped with Tahrpup. I may be wrong.
01micko: Though x264 is installed in Slacko5.6 it doesn't seem to work. I can't even call up the usage info :cry:

Code: Select all

# /usr/bin/x264 --help
/usr/bin/x264: error while loading shared libraries: libavformat.so.54: cannot open shared object file: No such file or directory
Last edited by MochiMoppel on Tue 05 Dec 2017, 13:21, edited 1 time in total.

User avatar
SFR
Posts: 1800
Joined: Wed 26 Oct 2011, 21:52

Re: How to convert WebP formatted images in Tahrpup/Fatdog?

#5 Post by SFR »

MochiMoppel wrote:I've learned that ffmpeg is not installed in Tahrpup and Fatdog, so how could this be done in these distributions? I've already tried avconv, but not dice :cry:
Of course there is ffmpeg in Fatdog OOTB.
Tahrpup ships with avconv instead, but just checked and like you said, it can't handle webp...

Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#6 Post by MochiMoppel »

Sorry, must have mixed it up. I'll correct my posts - of course :lol:

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#7 Post by musher0 »

To 01micko, MochiMoppei and all.

I am not a diviner. Posters should state a complete question properly, with
complete background.

In any case, I do not regret spending three hours yesterday evening
doing research on a valid solution that will benefit all Puppyists.


Have a boring day giving no background to anyone, everyone.
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#8 Post by musher0 »

Sorry for having been a grouch the other day.

Mutatis mutandis, the following two lines will give MochiMppei what he wants in a
cinch, using Google's dwebp and netpbm's pnmtojpeg:

Code: Select all

dwebp 2.webp -ppm -o 2.ppm
pnmtojpeg -quality=99 2.ppm > 2.jpg
BFN
Attachments
TahrPup-606_has_pnmtojpeg.jpg
(33.29 KiB) Downloaded 402 times
Last edited by musher0 on Fri 08 Dec 2017, 04:15, edited 2 times in total.
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

Sailor Enceladus
Posts: 1543
Joined: Mon 22 Feb 2016, 19:43

#9 Post by Sailor Enceladus »

MochiMoppel wrote:01micko: Though x264 is installed in Slacko5.6 it doesn't seem to work. I can't even call up the usage info :cry:

Code: Select all

# /usr/bin/x264 --help
/usr/bin/x264: error while loading shared libraries: libavformat.so.54: cannot open shared object file: No such file or directory
Interesting. I looked at mine in Slacko 5.7 and x264 --help gave the same message as you. It looks like three of the libraries (pulled from ffmpeg-2.0-i686-s14.0.pet) are .01 version too new for x264-snapshot-20120804-2245-i686.pet, and you either have to download x264-20120712-i486-1gv.txz from Salix to match ffmpeg2 or use ffmpeg-0.11.1-i686.pet to match the x264.

edit: Another option that worked for me was the x264-20131101-2245-i686_slk600.pet from Slacko 14.1 instead of Salix.
Attachments
Screenshot.png
symlinking the 55s to 54 and 52 to 51 for puppy-20120804 wasn't enough
(34.94 KiB) Downloaded 490 times

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#10 Post by musher0 »

Hello all.

I just added proof that tahrPup-606 has the pnmtojpeg utility in my message above:
http://murga-linux.com/puppy/viewtopic. ... ost#976446

Since pnmtojpeg is 13,9 Kb, and already in tahrPup, IMO it's not worth updating /
correcting the whole libav library -- if converting a webp image to jpg is the only
thing you wish to do. You embark the rather small webp package from Google (one
can even trim it further), you adapt my two-liner, and you're on your way.

But of course the Earth is round (sort of), and people are free!!!

BFN.
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
MochiMoppel
Posts: 2084
Joined: Wed 26 Jan 2011, 09:06
Location: Japan

#11 Post by MochiMoppel »

Sailor Enceladus wrote:Another option that worked for me was the x264-20131101-2245-i686_slk600.pet from Slacko 14.1.
Yeah, the --help option works now, that's a start :lol:
Unfortunately that doesn't mean that it can convert any webp image into a mkv container. When I try 01micko's x264 command I get an empty mkv file, accompanied by a funny error message:

Code: Select all

lavf [info]: 187x310p 0:1 @ 0/0 fps (cfr)
resize [error]: resolution 187x310 is not compliant with colorspace i420
Even if it would work I couldn't use it as a workaround for Tahrpup users: Tahrpup (I tested 6.0.5) doesn't ship with x264 ...

User avatar
greengeek
Posts: 5789
Joined: Tue 20 Jul 2010, 09:34
Location: Republic of Novo Zelande

#12 Post by greengeek »

MochiMoppel wrote:Though x264 is installed in Slacko5.6 it doesn't seem to work. I can't even call up the usage info :cry:

Code: Select all

# /usr/bin/x264 --help
/usr/bin/x264: error while loading shared libraries: libavformat.so.54: cannot open shared object file: No such file or directory
I gave this a go on my Slacko 5.6 derivative and had to progressively symlink existing (newer) versions of libavformat, libavcodec and libavutil but still no apparent result:

Code: Select all

# /usr/bin/x264 --help 
/usr/bin/x264: error while loading shared libraries: libavformat.so.54: cannot open shared object file: No such file or directory
# /usr/bin/x264 --help 
/usr/bin/x264: error while loading shared libraries: libavcodec.so.54: cannot open shared object file: No such file or directory
# /usr/bin/x264 --help 
/usr/bin/x264: error while loading shared libraries: libavutil.so.51: cannot open shared object file: No such file or directory
# /usr/bin/x264 --help

EDIT :Then I installed sailors pet (the one highlighted by MM) (had to do it manually as it refused to install automatically) and now -- help does work as you said. Where to from here? Anything I can try?

Code: Select all

# /usr/bin/x264 --help 
x264 core:138 r111M d37a857
Syntax: x264 [options] -o outfile infile

Infile can be raw (in which case resolution is required),
  or YUV4MPEG (*.y4m),
  or Avisynth if compiled with support (yes).
  or libav* formats if compiled with lavf support (yes) or ffms support (no).
Outfile type is selected by filename:
 .264 -> Raw bytestream
 .mkv -> Matroska
 .flv -> Flash Video
 .mp4 -> MP4 if compiled with GPAC support (no)
Output bit depth: 8 (configured at compile time)

Options:

  -h, --help                  List basic options
      --longhelp              List more options
      --fullhelp              List all options

Example usage:

      Constant quality mode:
            x264 --crf 24 -o <output> <input>

      Two-pass with a bitrate of 1000kbps:
            x264 --pass 1 --bitrate 1000 -o <output> <input>
            x264 --pass 2 --bitrate 1000 -o <output> <input>

      Lossless:
            x264 --qp 0 -o <output> <input>

      Maximum PSNR at the cost of speed and visual quality:
            x264 --preset placebo --tune psnr -o <output> <input>

      Constant bitrate at 1000kbps with a 2 second-buffer:
            x264 --vbv-bufsize 2000 --bitrate 1000 -o <output> <input>

Presets:

      --profile <string>      Force the limits of an H.264 profile
                                  Overrides all settings.
                                  - baseline,main,high,high10,high422,high444
      --preset <string>       Use a preset to select encoding settings [medium]
                                  Overridden by user settings.
                                  - ultrafast,superfast,veryfast,faster,fast
                                  - medium,slow,slower,veryslow,placebo
      --tune <string>         Tune the settings for a particular type of source
                              or situation
                                  Overridden by user settings.
                                  Multiple tunings are separated by commas.
                                  Only one psy tuning can be used at a time.
                                  - psy tunings: film,animation,grain,
                                                 stillimage,psnr,ssim
                                  - other tunings: fastdecode,zerolatency

Frame-type options:

  -I, --keyint <integer or "infinite"> Maximum GOP size [250]
      --tff                   Enable interlaced mode (top field first)
      --bff                   Enable interlaced mode (bottom field first)
      --pulldown <string>     Use soft pulldown to change frame rate
                                  - none, 22, 32, 64, double, triple, euro (requires cfr input)

Ratecontrol:

  -B, --bitrate <integer>     Set bitrate (kbit/s)
      --crf <float>           Quality-based VBR (0-51) [23.0]
      --vbv-maxrate <integer> Max local bitrate (kbit/s) [0]
      --vbv-bufsize <integer> Set size of the VBV buffer (kbit) [0]
  -p, --pass <integer>        Enable multipass ratecontrol
                                  - 1: First pass, creates stats file
                                  - 2: Last pass, does not overwrite stats file

Input/Output:

  -o, --output <string>       Specify output file
      --sar width:height      Specify Sample Aspect Ratio
      --fps <float|rational>  Specify framerate
      --seek <integer>        First frame to encode
      --frames <integer>      Maximum number of frames to encode
      --level <string>        Specify level (as defined by Annex A)
      --quiet                 Quiet Mode

Filtering:

      --vf, --video-filter <filter0>/<filter1>/... Apply video filtering to the input file

      Filter options may be specified in <filter>:<option>=<value> format.

      Available filters:
      crop:left,top,right,bottom
      resize:[width,height][,sar][,fittobox][,csp][,method]
      select_every:step,offset1[,...]

# 
EDIT 2 :Then I downloaded the 1.webp 01micko linked and tried his command:

Code: Select all

# x264 -o zz.mkv 1.webp ; mplayer -frames 1 -vo jpeg:outdir=/root 1 zz.mkv
lavf [info]: 550x368p 0:1 @ 0/0 fps (cfr)
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64 SlowShuffle
x264 [info]: profile High, level 2.2
x264 [info]: frame I:1     Avg QP:28.36  size: 22591                           
x264 [info]: mb I  I16..4: 31.2% 18.3% 50.6%
x264 [info]: 8x8 transform intra:18.3%
x264 [info]: coded y,uvDC,uvAC intra: 83.8% 85.8% 47.7%
x264 [info]: i16 v,h,dc,p:  6% 33% 43% 18%
x264 [info]: i8 v,h,dc,ddl,ddr,vr,hd,vl,hu:  7% 29% 27%  7%  7%  3%  9%  3%  8%
x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 10% 23% 28%  7%  6%  4%  7%  4% 11%
x264 [info]: i8c dc,h,v,p: 48% 39% 10%  2%
x264 [info]: kb/s:4518.20

encoded 1 frames, 28.11 fps, 4662.40 kb/s
Creating config file: /root/.mplayer/config
MPlayer SVN-r36362-snapshot-4.7.1 (C) 2000-2013 MPlayer Team

Playing 1.
File not found: '1'
Failed to open 1.


Playing zz.mkv.
libavformat version 55.12.100 (external)
Mismatching header version 55.13.102
libavformat file format detected.
[lavf] stream 0: video (h264), -vid 0
VIDEO:  [H264]  550x368  0bpp  25.000 fps    0.0 kbps ( 0.0 kbyte/s)
Load subtitles in ./
jpeg: Progressive JPEG disabled.
jpeg: Baseline JPEG enabled.
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
libavcodec version 55.18.102 (external)
Mismatching header version 55.23.100
Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
==========================================================================
Audio: no sound
Starting playback...
Could not find matching colorspace - retrying with -vf scale...
Opening video filter: [scale]
Movie-Aspect is undefined - no prescaling applied.
[swscaler @ 0xb6d663f4]using unscaled yuv420p -> rgb24 special converter
VO: [jpeg] 550x368 => 550x368 RGB 24-bit 
jpeg: /root - Output directory already exists and is writable.
V:   0.0   0/  0 ??% ??% ??,?% 0 0 


Exiting... (End of file)
# 
It created files 00000001.jpg (which was a jpg version of the original image - but with a skinny black strip down the RHS) and zz.mkv (which was just a black image)
Attachments
00000001.jpg
(58.85 KiB) Downloaded 262 times

@Kiteh_Kawasaki
Posts: 17
Joined: Fri 24 Mar 2017, 08:16

#13 Post by @Kiteh_Kawasaki »

Develop rinse repeat Goog is lame so is Unix so do webp AFTER deployment.
Currently: @KitehDotNet

Post Reply