[Chicago-talk] Forking and Memory
richard at rushlogistics.com
richard at rushlogistics.com
Fri Mar 11 09:01:27 PST 2016
I have this code below that forks to convert a large uploaded video. I just tried a 72M video and got:
Route exception: Can't fork: Cannot allocate memory at /usr/local/share/perl/5.20.2/Mail/Transport/Sendmail.pm
Is there something wrong with my code or do I need more RAM?
if ($file_stg =~ /MOV/) {
#print "File is a MOV\n";
if (my $kid = fork()) {
waitpid($kid, 0); # let the child die
} else {
if (my $grandkid = fork) {
POSIX::_exit(0); # the child dies here
} elsif (defined $kid && $kid == 0) {
# child
system("ffmpeg -i $self->{_video_in} -vcodec libx264 -profile:v main -level 3.1 -preset veryslow -crf 23 -x264-params ref=4 -acodec copy -movflags +faststart -vf scale=-2:720:flags=lanczos $self->{_video_out}.mp4");
system("ffmpeg -i $self->{_video_out}.mp4 -c:v libtheora -c:a libvorbis $self->{_video_out}.ogv");
#exit 0;
POSIX::_exit(0)
}
}
}
More information about the Chicago-talk
mailing list