User Tools

Site Tools


howto:convert-images

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
howto:convert-images [2024/07/28 12:56] Wulf Rajekhowto:convert-images [2025/05/20 11:23] (current) – [lossy conversion of png to jpg] Wulf Rajek
Line 28: Line 28:
 </code> </code>
  
-===== lossless changing containers between webm/mov/mp4/mkv =====+===== lossy conversion of png to jpg ===== 
 +Converts all png files in the directory recursively to jpg 
 +<code> 
 +find . -iname '*.png' | while read i; do mogrify -format jpg "$i" && rm "$i"; echo "Converted $i to ${i%.*}.jpg"; done 
 +</code> 
 + 
 +===== png to ico ===== 
 +To create favicon ico files, the following command creates multiple sizes and stores them in the ico file and keeps transparency. Adjust as required.: 
 +<code> 
 +convert logo.png -define icon:auto-resize=256,64,48,32,16 favicon.ico 
 +</code> 
 + 
 +===== lossless changing containers between webm/mov/mp4/mkv/m4v =====
  
-webm/mov/mkv/mp4 are container formats and can contain various encoded video or audio streams. To change the container between each other, the following command can be used, provided the used codecs inside the containers are compatible:+webm/mov/mkv/mp4/m4v are container formats and can contain various encoded video or audio streams. To change the container between each other, the following command can be used, provided the used codecs inside the containers are compatible:
 <code> <code>
 ffmpeg -i file.webm -c:a copy -c:v copy file.mkv ffmpeg -i file.webm -c:a copy -c:v copy file.mkv
Line 38: Line 50:
 #find . -type f -iname '*.webm' -delete #find . -type f -iname '*.webm' -delete
  
-#lossless change container mkv, webm, mov -> mp4 +#lossless change container mkv, webm, mov, m4v -> mp4 
-find . -type f \( -iname "*.mkv" -o -iname "*.webm -o -iname "*.mov\) | while read f; do+find . -type f \( -iname "*.mkv" -o -iname "*.webm-o -iname "*.mov" -o -iname "*.m4v" \) | while read f; do
     ffmpeg -i "$f" -codec copy "${f%.*}.mp4"     ffmpeg -i "$f" -codec copy "${f%.*}.mp4"
 done done
Line 45: Line 57:
  
 ===== high quality conversion to mp4 ===== ===== high quality conversion to mp4 =====
 +<code>
 #High quality non-mp4 to mp4 conversion #High quality non-mp4 to mp4 conversion
 find . -type f \( -iname "*.mpg" -o -iname "*.asf" -o -iname "*.wmv" -o -iname "*.mpg" -o -iname "*.mpeg" -o -iname "*.avi" -o -iname "*.divx" -o -iname "*.rmvb" -o -iname "*.rm" -o -iname "*.m4v" -o -iname "*.flv" \) | while read f; do find . -type f \( -iname "*.mpg" -o -iname "*.asf" -o -iname "*.wmv" -o -iname "*.mpg" -o -iname "*.mpeg" -o -iname "*.avi" -o -iname "*.divx" -o -iname "*.rmvb" -o -iname "*.rm" -o -iname "*.m4v" -o -iname "*.flv" \) | while read f; do
     ffmpeg -nostdin -i "$f" -vcodec libx264 -acodec aac "${f%.*}.mp4"     ffmpeg -nostdin -i "$f" -vcodec libx264 -acodec aac "${f%.*}.mp4"
 done done
- +</code>
 ===== find all non-mp4 files ===== ===== find all non-mp4 files =====
 <code> <code>
Line 196: Line 208:
 done done
 IFS=$SAVEIFS IFS=$SAVEIFS
 +</code>
 +
 +
 +===== 3D VR SBS to 2D =====
 +
 +https://blog.interstellar.co.jp/en/2022/06/21/converting-vr180-videos-to-2d-videos-with-ffmpeg/
 +
 +<code>
 +ffmpeg -i input.mp4 -vf v360=input=equirect:output=flat:ih_fov=180:iv_fov=180:h_fov=93:v_fov=121:in_stereo=sbs:w=960:h=640 -codec:v h264 output.mp4
 +</code>
 +
 +https://video.stackexchange.com/questions/21084/how-to-convert-a-3d-movie-to-2d-using-ffmpeg
 +
 +<code>
 +ffmpeg -i input.mkv -vf stereo3d=sbsl:ml -metadata:s:v:0 stereo_mode="mono" output.mkv
 +</code>
 +Use sbsl2:ml or  -aspect 16:9 if the aspect ratio is wrong
 +
 +
 +https://stackoverflow.com/questions/66960003/unwarping-180-vr-footage-with-ffmpeg-v360-filter
 +
 +
 +https://github.com/paulpaul999/vr-video-notes/blob/main/vr-to-flat/README.md
 +<code>
 +ffmpeg -i equirectangular.mp4 -filter:v "v360=input=hequirect:output=flat:in_stereo=sbs:out_stereo=2d:d_fov=125:w=1920:h=1080:pitch=+5" -map 0 -c copy -c:v h264 -pix_fmt yuv420p flat.mp4
 +</code>
 +
 +===== Mono to Stereo MP3 =====
 +
 +Conversion using ffmpeg -ac 2 reduces volume by 3db, apparently to keep perceived loudness the same. To maintain the same volume use pan as below. 
 +
 +<code>
 +for i in {01..33}; do 
 +  ffmpeg -i "Chapter "$i".mp3" -af "pan=stereo|c0=c0|c1=c0" "Chapter "$i"s.mp3"; 
 +done
 </code> </code>
  
howto/convert-images.1722167771.txt.gz · Last modified: by Wulf Rajek