zaki | pavlushka, ffmpeg -find_stream_info -i test.mkv -map 0 -codec copy -codec:s mov_text test.mp4 | 15:58 |
---|---|---|
zaki | a need to do a automation with this. which will find all the mkv in directory and convert to mp4 and remove the original or merge | 15:59 |
zaki | remonshai, any idea? | 16:00 |
pavlushka | zaki: use && find -exec delete kind of | 16:01 |
remonshai | sorry.. | 16:01 |
pavlushka | zaki: && find . -name "name" -type f -exec rm -r "{}" \; | 16:03 |
pavlushka | zaki: && find . -name "*.mkv" -type f -exec rm -r "{}" \; | 16:03 |
remonshai | Why do you need this? | 16:05 |
remonshai | I means converting. | 16:05 |
zaki | pavlushka, yes | 16:06 |
zaki | cause mkv is not supported on many platform | 16:06 |
zaki | I can't play mkv on browser | 16:07 |
zaki | any browser on unix | 16:07 |
zaki | IOS | 16:07 |
zaki | sometime it works on windows chrome browser | 16:07 |
zaki | depends on the codec | 16:08 |
zaki | I tried changing mime on the Nginx | 16:08 |
pavlushka | i know | 16:08 |
remonshai | oh ;/ | 16:08 |
zaki | so I have two option use a real time transcoder | 16:08 |
zaki | or php-ffmpeg module with my php script | 16:09 |
zaki | emby use transcoder and keep the transcoded file in a temporary directory so it works on all device | 16:10 |
zaki | gives output based on client device | 16:10 |
zaki | bt I have another PHP script for movie server, which says it support mkv but it is not | 16:11 |
pavlushka | aha | 16:13 |
zaki | so I'm facing issue like if there is 40000 file 60% of its mkv or avi | 16:13 |
zaki | ffmpeg -find_stream_info -i test.mkv -map 0 -codec copy -codec:s mov_text test.mp4 its works without losing any quality | 16:14 |
zaki | pavlushka, for f in *.mkv; do ffmpeg -i "$f" -c:v libx264 -preset medium -c:a aac -c:s mov_text "${f%.mkv}.mp4"; done | 17:51 |
pavlushka | zaki: wow, I don't know bash scripting | 17:52 |
zaki | pavlushka, H.264 AAC is the best format and preset medium is for the quality , it takes time to convert with medium preset , you can set it to slower or faster | 17:55 |
zaki | faster will convert the file faster but quality will be worse | 17:55 |
zaki | slower preset will take much time but quality good | 17:55 |
zaki | now I put this script on folders and run sh | 17:57 |
pavlushka | cool | 18:01 |
zaki | oh I need to remove the original after | 18:05 |
pavlushka | zaki: find . -name "*.mkv" -type f -exec rm -r "{}" \; | 18:49 |
zaki | && rm *.mkv after the bash script ? | 18:50 |
pavlushka | will do | 18:51 |
pavlushka | that was for subdirectories included | 18:51 |
zaki | will run this per directory | 18:53 |
pavlushka | that appears | 18:53 |
zaki | pavlushka, got another | 18:56 |
zaki | rm -f -- "$f" below previous script , | 18:57 |
zaki | it delete file after conversion done. | 18:57 |
zaki | I mean if you have to mkv in the folder it convert 1st one then delete the 1st one source then start the 2nd one | 18:58 |
zaki | ah | 19:00 |
zaki | great | 19:00 |
zaki | just tested | 19:00 |
zaki | so my whole script is | 19:00 |
zaki | #!/bin/bash | 19:01 |
zaki | for f in *.mkv; | 19:01 |
zaki | do ffmpeg -i "$f" -c:v libx264 -preset medium -c:a aac -c:s mov_text "${f%.mkv}.mp4"; | 19:01 |
zaki | rm -f -- "$f" | 19:01 |
zaki | done | 19:01 |
zaki | pavlushka, ^ | 19:01 |
zaki | if you have two mkv* | 19:02 |
zaki | @pavlushka, I think I can speed up the process by detecting the codec using ffmpeg before converting and inside mkv container if it found that the codec is already H.264 & AAC it will just copy the codec instead of encoding again and convert to mp4 and if it found other codec inside mkv it will encode to H264 AAC | 19:09 |
pavlushka | zaki: wow | 19:12 |
zaki | don't know how to search this on google :P | 19:12 |
pavlushka | zaki: you can filter that with mediatype | 19:13 |
zaki | where ? | 19:14 |
pavlushka | zaki: https://askubuntu.com/questions/781408/how-can-i-find-media-files-not-encoded-with-a-specific-codec | 19:14 |
u-la-la | [ video - How can I find media files not encoded with a specific codec? - Ask Ubuntu ] - askubuntu.com ( https://tinyurl.com/skvz82j ) | 19:14 |
pavlushka | zaki: sorry mediainfo | 19:15 |
zaki | pavlushka, https://superuser.com/questions/1180108/conditionally-encode-or-copy-audio-stream-using-ffmpeg | 19:16 |
u-la-la | [ linux - Conditionally encode or copy audio stream using FFMpeg - Super User ] - superuser.com ( https://tinyurl.com/t8k8kav ) | 19:16 |
zaki | this is better I think | 19:17 |
pavlushka | me too | 19:17 |
pavlushka | night night | 20:00 |
Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!