[FFmpeg-trac] #4170(undetermined:new): ffmpeg is modifying shell memory?

FFmpeg trac at avcodec.org
Tue Dec 9 02:03:57 CET 2014


#4170: ffmpeg is modifying shell memory?
-------------------------------------+-------------------------------------
             Reporter:  MisterE2002  |                     Type:  defect
               Status:  new          |                 Priority:  normal
            Component:               |                  Version:
  undetermined                       |  unspecified
             Keywords:  bash loop    |               Blocked By:
  strange output                     |  Reproduced by developer:  0
             Blocking:               |
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
 Summary of the bug: using ffmpeg in a bash script is changing the outcome
 How to reproduce:
 I am using this command:
 {{{
 ./del.sh -d "/home/test/_TESTENDEL/"
 }}}
 In this folder are a couple of mp4 files.



 if the "ffmpeg" line is commented the script works correct
 expected output:
 {{{
 [test at laptop _SCRIPTS]$ ./del.sh  -d "/home/test/_TESTENDEL/"
 listing of list:
 /home/test/_TESTENDEL/film2.mp4
 /home/test/_TESTENDEL/film.mp4
 INFO: processing file (1/2): "/home/test/_TESTENDEL/film2.mp4"
 0
 listing of list:
 /home/test/_TESTENDEL/film2.mp4
 /home/test/_TESTENDEL/film.mp4
 INFO: processing file (2/2): "/home/test/_TESTENDEL/film.mp4"
 0
 }}}


 if i enabled the "ffmpeg" line the script gives wrong outputs:
 {{{
 [test at laptop _SCRIPTS]$ ./del.sh  -d "/home/test/_TESTENDEL/"
 listing of list:
 /home/test/_TESTENDEL/film2.mp4
 /home/test/_TESTENDEL/film.mp4
 INFO: processing file (1/2): "/home/test/_TESTENDEL/film2.mp4"
 0
 listing of list:
 /home/test/_TESTENDEL/film2.mp4
 /home/test/_TESTENDEL/film.mp4
 INFO: processing file (2/2): "film.mp4"
 1
 }}}

 notice, the path is dissapeared. Sometimes letters of the filename itself
 are gone too.
 In some cases the loop itself refuses to iterate to the next file.
 If i add more files all odd filename are wrong.



 ffmpeg is doing something to the shell?


 extra info:
 Fedora: Linux laptop.local 3.17.4-200.fc20.x86_64 #1 SMP Fri Nov 21
 23:26:41 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
 ffmpeg version 2.1.6, built on Nov 29 2014 12:07:56 with gcc 4.8.3 (GCC)
 20140911 (Red Hat 4.8.3-7)



 the bash script:

 {{{
 #!/bin/bash




 # $1: complete path to directory
 process () {


   list=$(find "$1" -maxdepth 1 -type f -name "*.mp4")
   amount=$(echo "$list" | sed '1{/^$/d}' | wc -l)
   currentindex=0


   rm -f log.LOG


   echo "$list" |sort | while read file; do
   #while read file; do

     echo "listing of list:"
     echo "$list"

     currentindex=$((currentindex+1))


     echo "INFO: processing file (${currentindex}/${amount}): \"$file\""

     #log=$(ffmpeg -y -i "$file" -t 00:02:30  "${file}.mp3"  2>&1)
     #ffmpeg -y -i "$file"  -t 00:02:30  "${file}.mp3"

     log=$(ffmpeg -y -v 9 -loglevel 99 -i "$file" -t 00:02:30
 "${file}.mp3" 2>&1)
     echo $?
     echo $log >> log.LOG
     echo "*** $currentindex ***" >> log.LOG


   #done < <(echo "$list"|sort)
   done
 }






 DIR=


 while getopts ":d:cevlA" opt; do
   case $opt in
     d)
       DIR="$OPTARG"
       ;;

     \?)
       echo "Invalid argument: -$OPTARG" >&2
       exit $E_ARGS
       ;;
   esac
 done






 process "$DIR"
 }}}

--
Ticket URL: <https://trac.ffmpeg.org/ticket/4170>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list