[FFmpeg-user] Using Jon Severinsson's PPA on Ubuntu 14.04, can't detach.

Luke Davis l1 at newanswertech.com
Mon Mar 16 08:05:05 CET 2015


On Mon, 16 Mar 2015, Tim Beyer wrote:

> I am running Jon Severinsson's PPA on Ubuntu 14.04 in a screened process -
> it is a player that reads video files out of a folder, randomly. The whole
> process goes through a while loop. In the screen session the switchting
> between files works fine - but I can't detach with crtl+a and d or with q -
> it is starting the process again. When I try to detach afterwards with
> ctrl+c from screen, it waits a while and kicks me back into the ffmpeg
> process. If I just close the terminal, ffmpeg crashes when the next
> file-change comes. Same, when I try starting the screen already detached,
> or if I forward the process to dev/null and into a log.

I'm not 100% sure what you want the end result to be, but I don't think your 
script does what you think it does.

you're creating a series of screen sessions named "VOD".  Each one of those 
sessions has a single window.  You can't switch between them, because they exist 
sequentially.

It sounds like you want a single screen session, with each video in a separate 
window so you can switch between them.
You're doing the while loop, so that after all of the files are opened and you 
exit/detach the screen session, the whole thing starts over again in a new 
screen session.

If that is what you want, this will likely work:

#!/bin/bash
while true
do
 	# Start the screen (w/one shell window) but instantly detach it
 	screen -dmS vod
        for file in $(ls * | shuf -n 1)
        do
 		# For each file, create a window in the running screen,
 		# named with the filename, and running the ffmpeg command
                screen -S vod -X screen -h 0 -t "$file" ffmpeg -re -i "$file" \
 		-acodec copy -vcodec copy -f flv ServerAddress
         done
 	# Delete the useless shell in the first screen window
 	screen -S vod -p 0 -X kill
 	# Attach to the screen for actual access of the running processes
 	screen -r vod
  done

If that wasn't what you wanted, then enjoy my useless code.:)

Luke



More information about the ffmpeg-user mailing list