Advertisement
gheja

Untitled

Apr 27th, 2021
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.69 KB | None | 0 0
  1. $ cat /usr/local/bin/a.sh
  2. #!/bin/bash
  3.  
  4. cd /mnt/data/events/9 || exit 1
  5.  
  6. tmp="convert.mp4"
  7.  
  8. find -type f -iname '*-video.mp4' | while read filename; do
  9. echo "$filename: converting..."
  10.  
  11. nice -n 3 ffmpeg -i $filename -vcodec h264 -threads 1 -b:v 3M -y $tmp >convert.tmp 2>&1
  12.  
  13. if [ $? != 0 ]; then
  14. echo "$filename: failed to convert"
  15. continue
  16. fi
  17.  
  18. echo "$filename: successfully converted"
  19. done
  20.  
  21. $ /usr/local/bin/a.sh
  22. ./2021-04-27/23905/23905-video.mp4: converting...
  23. ./2021-04-27/23905/23905-video.mp4: successfully converted
  24. 1/24041-video.mp4: converting...
  25. 1/24041-video.mp4: failed to convert
  26. ./2021-04-27/24045/24045-video.mp4: converting...
  27. ./2021-04-27/24045/24045-video.mp4: successfully converted
  28. 21-04-27/24296/24296-video.mp4: converting...
  29. 21-04-27/24296/24296-video.mp4: failed to convert
  30. ./2021-04-27/23709/23709-video.mp4: converting...
  31. ./2021-04-27/23709/23709-video.mp4: successfully converted
  32. 273-video.mp4: converting...
  33. 273-video.mp4: failed to convert
  34. ./2021-04-27/24179/24179-video.mp4: converting...
  35. ^C
  36.  
  37. ---
  38.  
  39. $ cat /usr/local/bin/c.sh
  40. #!/bin/bash
  41.  
  42. cd /mnt/data/events/9 || exit 1
  43.  
  44. tmp="convert.mp4"
  45.  
  46. dummy()
  47. {
  48. return
  49. }
  50.  
  51. find -type f -iname '*-video.mp4' | while read filename; do
  52. echo "$filename: converting..."
  53.  
  54. dummy
  55.  
  56. if [ $? != 0 ]; then
  57. echo "$filename: failed to convert"
  58. continue
  59. fi
  60.  
  61. echo "$filename: successfully converted"
  62. done
  63.  
  64. $ /usr/local/bin/c.sh
  65. ./2021-04-27/23905/23905-video.mp4: converting...
  66. ./2021-04-27/23905/23905-video.mp4: successfully converted
  67. ./2021-04-27/23754/23754-video.mp4: converting...
  68. ./2021-04-27/23754/23754-video.mp4: successfully converted
  69. ./2021-04-27/23988/23988-video.mp4: converting...
  70. ./2021-04-27/23988/23988-video.mp4: successfully converted
  71. ./2021-04-27/23989/23989-video.mp4: converting...
  72. ./2021-04-27/23989/23989-video.mp4: successfully converted
  73. ./2021-04-27/24081/24081-video.mp4: converting...
  74. ./2021-04-27/24081/24081-video.mp4: successfully converted
  75. ./2021-04-27/24189/24189-video.mp4: converting...
  76. ./2021-04-27/24189/24189-video.mp4: successfully converted
  77. ./2021-04-27/24327/24327-video.mp4: converting...
  78. ./2021-04-27/24327/24327-video.mp4: successfully converted
  79. ./2021-04-27/23593/23593-video.mp4: converting...
  80. ./2021-04-27/23593/23593-video.mp4: successfully converted
  81. ./2021-04-27/24244/24244-video.mp4: converting...
  82. ./2021-04-27/24244/24244-video.mp4: successfully converted
  83. ./2021-04-27/23584/23584-video.mp4: converting...
  84. ./2021-04-27/23584/23584-video.mp4: successfully converted
  85. ./2021-04-27/23963/23963-video.mp4: converting...
  86.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement