107

Here's what worked for me: ffmpeg -i animated.gif -movflags faststart -pix_fmt yuv420p -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" video.mp4 movflags – This option optimizes the structure of the MP4 file so the browser can load it as quickly as possible. pix_fmt – MP4 videos store pixels in different formats. We include this option to specify a specific ...


80

convert is a handy command line tool to do that. cd to the folder containing your png-files and run this command: convert -delay 10 -loop 0 *.png animation.gif Source: http://ubuntuforums.org/showthread.php?t=1132058


62

In bash: for f in *.jpg; do convert ./"$f" ./"${f%.jpg}.pdf" done


60

Last time I used convert for such a task I explicitly specified the size of the destination via resizing: $ i=150; convert a.png b.png -compress jpeg -quality 70 \ -density ${i}x${i} -units PixelsPerInch \ -resize $((i*827/100))x$((i*1169/100)) \ -repage $((i*827/100))x$((i*1169/100)) multipage.pdf The convert command doesn't always use ...


56

You can use the mogrify command for this. Normally, it modifies files in-place, but when converting formats, it writes a new file (just changing the extension to match the new format). Thus: mogrify -format pdf -- *.jpg (Like enzotib's ./*.jpg, the -- prevents any strange filenames from being interpreted as switches. Most commands recognize -- to mean "...


52

Just an addition since I had issues with the python script (and several other solutions): for me mutool worked great. It's a simple and small addition shipped with the elegant mupdf reader. So you can try: mutool poster -y 2 input.pdf output.pdf For horizontal splits, replace y with x. And you can, of course, combine the two for more complex solutions. ...


50

Newer versions of ffmpeg have no -sameq (see faq) but do have GIF support. ffmpeg -i %03d.png output.gif Where %03d is the frame ID in 3 digits. You may also try to use ffmpeg to create a movie out of a sequence of images and then convert the movie to a GIF animation (again using ffmpeg). # cf. http://pages.uoregon.edu/noeckel/MakeMovie.html # ...


48

found a solution: identify, part of the imagemagick package, does exactly what I need $ identify color.jpg > color.jpg JPEG 1980x650 1980x650+0+0 8-bit DirectClass 231KB 0.000u 0:00.000


44

Rather than parsing the output of identify by eye, or by text utilities, you can use its -format option to output the width and height in whatever format suits you best. For example: $ identify -format '%w %h' img.png 100 200 $ identify -format '%wx%h' img.png 100x200 A list of image properties that you can output can be found on this page, but for the ...


38

take a look at this: https://askubuntu.com/questions/107726/how-to-create-animated-gif-images-of-a-screencast/107735#107735 ..... After the Desktop Recorder has saved the recording into an OGV video, MPlayer will be used to capture JPEG screenshots, saving them into the 'output' directory. On a terminal: mplayer -ao null <video file name> -vo jpeg:...


38

In my case, using ffmpeg directly did the trick and provided the best result: $ ffmpeg -f gif -i infile.gif outfile.mp4


34

pandoc can do this. It's more focused on converting marked-up text to various formats, but it should have no problems with simple plaintext. pandoc input.txt -o output.pdf


32

Depending on how your original file was encoded, it may not be possible to keep the file size. ffmpeg -i infile.avi youroutput.mp4 should keep frame sizes and rates intact while making an mp4 file. ffmpeg -i infile.avi will give you information about your input file - the frame size, codecs used, bitrate, etc. You can also play with the acodec and ...


27

Since it's a fixed set of numbers, you can do it by hand: $ echo ۲۱ | LC_ALL=en_US.UTF-8 sed -e 'y/۰۱۲۳۴۵۶۷۸۹/0123456789/' 21 (or using tr, but not GNU tr yet) Setting your locale to en_US.utf8 (or better to the locale which characters set belongs to) is required for sed to recognize your characters set. With perl: $ echo "۲۱" | perl -CS -MUnicode::...


24

faster but unusual syntax: parallel convert '{} {.}.pdf' ::: *.jpg Runs in parallel (using https://www.gnu.org/software/parallel/). I haven't noticed any multi-threading in convert yet, which would limit the effective parallelization. If that is your concern, see in the comment below for a method to ensure no multi-threading occurs.


23

What you really want to use is: $ convert a.png b.png -compress jpeg -resize 1240x1753 \ -extent 1240x1753 -gravity center \ -units PixelsPerInch -density 150x150 multipage.pdf -extent actually extends the image to be 1240x1753, while -resize keeps the image's ratio, fitting it into either 1240x... or ...x1753. ...


23

pandoc is a great command-line tool for file format conversion. The disadvantage is for PDF output, you’ll need LaTeX. The usage is pandoc test.html -t latex -o test.pdf If you don't have LaTeX installed, then I recommend htmldoc. Cited from Creating a PDF By default, pandoc will use LaTeX to create the PDF, which requires that a LaTeX engine be ...


21

OpenOffice comes with the unoconv program to perform format conversions on the command line. unoconv -f csv filename.xlsx For more complex requirements, you can parse XLSX files with Spreadsheet::XLSX in Perl or openpyxl in Python. For example, here's a quickie script to print out a worksheet as a semicolon-separated CSV file (warning: untested, typed ...


21

Simple script with good quality Script: inputFile=$1 FPS=15 WIDTH=320 #Generate palette for better quality ffmpeg -i $inputFile -vf fps=$FPS,scale=$WIDTH:-1:flags=lanczos,palettegen tmp_palette.png #Generate gif using palette ffmpeg -i $inputFile -i tmp_palette.png -loop 0 -filter_complex "fps=$FPS,scale=$WIDTH:-1:flags=lanczos[x];[x][1:v]paletteuse" ...


20

You can use the uconv utility from ICU. Normalization is achieved through transliteration (-x). $ uconv -x any-nfd <<<ä | hd 00000000 61 cc 88 0a |a...| 00000004 $ uconv -x any-nfc <<<ä | hd 00000000 c3 a4 0a |...| 00000003 On Debian, Ubuntu and other ...


19

The convert's --delay option only applies to the next image on the command line. So convert -delay 10 * will only set the delay of the first frame to 0.1 second. The option need to be repeated: convert $(for a in *; do printf -- "-delay 10 %s " $a; done; ) result.gif For your sorting need, convert does not sort frames, the shell globing * does. If you know ...


19

potrace I found this example on SO in a Q&A titled: How to convert a JPEG image into SVG format using ImageMagick?. One of the answers suggested potrace. $ convert input.jpg output.ppm $ potrace -s output.ppm -o svgout.svg Results                      &...


16

https://gitlab.mister-muffin.de/josch/img2pdf In all of the proposed solutions involving ImageMagick, the JPEG data gets fully decoded and re-encoded. This results in generation loss, as well as performance "ten to hundred" times worse than img2pdf. Can be installed with pip img2pdf provided you have dependencies (e.g. apt-get install python python-pil ...


15

you can just use the command "file" to get the informations you need: ~# file cha_2.png cha_2.png: PNG image data, 656 x 464, 8-bit/color RGB, non-interlaced


15

First of all, -aq sets a quality-based variable bit rate - I think you're looking for -ab (note that I'm an ffmpeg user, so my knowledge of avconv syntax is limited - I've no idea how far it's drifted since the fork). Regardless, the built-in avconv/ffmpeg AAC encoder is pretty bad. fdk_aac The only really good AAC encoder for avconv/ffmpeg is libfdk_aac ...


15

For Python there is the unidecode library which handles such conversions in general: https://pypi.python.org/pypi/Unidecode. In Python 2: >>> from unidecode import unidecode >>> unidecode(u"۰۱۲۳۴۵۶۷۸۹") '0123456789' In Python 3: >>> from unidecode import unidecode >>> unidecode("۰۱۲۳۴۵۶۷۸۹") '0123456789' The SO thread ...


14

(adapted from comments above) Depending on the codecs used (some codecs are incompatible with some containers), you could always simply copy the streams (-codec copy). That is the best way to avoid quality changes, as you're not reencoding the streams, just repackaging those in a different container. When dealing with audio/video files, it is important to ...


14

Use the convert command from ImageMagick: convert x.png -resize 25% x.jpg will create a 25%-scaled JPEG version of x.png. To do all the PNG files at once, use a for loop: for filename in *.png ; do convert "$filename" -resize 25% "${filename%.png}.jpg" ; done We look at every file matching *.png, and for each one run the convert command above. "${...


13

Here is a way that combines the best of the above suggestions into a simple, efficient, robust command line: find /path/to/files -iname '*.jpg' -exec mogrify -format pdf {} + It works fine with filenames that begin with a - or contain spaces. Note the use of -iname which is the case-insensitive version of -name so it will work on .JPG just as well as .jpg. ...


13

Both WAV and FLAC formats are lossless, which means they do not lose any quality from an original music CD. WAV however is uncompressed, while FLAC uses a lossless compression mechanism (pretty much like a ZIP lossless compression) specifically designed for efficient packing of audio data. FLAC files can then be played with your favorite player, just like ...


Only top voted, non community-wiki answers of a minimum length are eligible