These are chat archives for ipython/ipython

31st
Jul 2016
epifanio
@epifanio
Jul 31 2016 15:19
Hi
I’m running a for loop in a notebook, using a system call to ffmpeg. The code looks like:
for i in list(imgtracklines.keys()):
    filename = 'inputframes_%s.txt' % i
    !ffmpeg -nostats -hide_banner -f concat -i {filename} \
    -c:v libx264 -preset ultrafast -qp 0 -movflags +faststart \
        -pix_fmt yuv420p ../{i}.mkv
after the execution is complete (It generates some videos from a sequence of input images) the ipython notebook seems to keep all the processed data in memory. Until the end of the loop
epifanio
@epifanio
Jul 31 2016 15:25
is it a normal behavior? should I use subprocess instead of ! ? or perhaps this has nothing to do with python and it is just ffmpeg which takes a little to free-up the memory?
Afshin Taylor Darian
@afshin
Jul 31 2016 16:38
@epifanio I'm not an expert on this, but I think that under the hood the ! escape sequence uses os.system() in Windows and it uses subprocess.call() in all other platforms. So if you manually switched to using subprocess, I suspect you won't see any difference at all. Hopefully, someone else can confirm this is the case.
epifanio
@epifanio
Jul 31 2016 20:43
@afshin thanks, i’m pretty sure it is related to ffmpeg. I’m gonna repeat the process 2 more times (bash vs python loops) and try to monitor ram consumption :)