Konsole don't show typed input after parsing mplayer output
up vote
0
down vote
favorite
I have a very strange behaviour with the script below. It executes properly, but after that anything I type at the prompt is recognized, but not displayed. So I can type another command or use the arrow buttons to select one from the history, but the prompt remains empty. If I execute the new, invisible command, the command output is displayed correctly, but the problem remains. Only with a new terminal instance the problem is gone.
#!/bin/bash
getAspect () {
aspectR=$(
mplayer -vo null -nosound "$1" 2>&1 |
while read line; do # wait until mplayer prints aspect infos or starts to play
[[ $line =~ Aspe[ck]t.is.*1.33:1 ]] && echo 1 && break
[[ $line =~ Aspe[ck]t.is.*0.56:1 ]] || [[ $line =~ Aspe[ck]t.is.*1.78:1 ]] && echo 2 && break
[[ $line == "VO: [null]"* ]] && echo 0 && break
done
pkill -n mplayer
)
return $aspectR # returns 1 (4:3), 2 (16:9) or 0 (no aspect ratio)
}
getAspect "./NameOfAMovieFile"
I could narrow down the problem to the following:
Using the mplayer output (see below) I inserted another test [[ $line =~ such ]] && echo 9 && break
in the loop to sequentially check at which line the problem started.
Result: Line 4 (LIRC). If the test matched any line before, the problem didn't occur, else it did.
Saving the mplayer output to file and replacing mplayer with cat "saved_output"
in the function didn't raise the problem.
So where does the error lie?
Is it a bug in the function, mplayer producing some weird output, bash or my terminal programs (tested with Konsole and Yakuake)?
How can I fix this?
# mplayer -vo null -nosound "./NameOfAMovieFile" 2>&1
MPlayer 1.2.r38008-Packman-8 (C) 2000-2017 MPlayer Team
do_connect: could not connect to socket
connect: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.
Playing ./NameOfAMovieFile.
libavformat version 58.12.100 (external)
libavformat file format detected.
[lavf] stream 0: video (h264), -vid 0
[lavf] stream 1: audio (vorbis), -aid 0, -alang eng
VIDEO: [H264] 1280x720 0bpp 29.970 fps 0.0 kbps ( 0.0 kbyte/s)
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
libavcodec version 58.18.100 (external)
Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
==========================================================================
Clip info:
COMPATIBLE_BRANDS: iso6avc1mp41
MAJOR_BRAND: dash
MINOR_VERSION: 0
ENCODER: Lavf57.71.100
Load subtitles in ./
Audio: no sound
Starting playback...
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
VO: [null] 1280x720 => 1280x720 Planar YV12 [zoom]
V: 0.0 0/ 0 ??% ??% ??,?% 0 0 [J
V: 0.0 0/ 0 ??% ??% ??,?% 0 0 [J
MPlayer interrupted by signal 2 in module: sleep_timer
V: 3.1 0/ 0 19% 0% 0.0% 0 0 [J
Exiting... (Quit)
My system: OpenSuse TumbleWeed, KDE
bash shell-script mplayer
add a comment |
up vote
0
down vote
favorite
I have a very strange behaviour with the script below. It executes properly, but after that anything I type at the prompt is recognized, but not displayed. So I can type another command or use the arrow buttons to select one from the history, but the prompt remains empty. If I execute the new, invisible command, the command output is displayed correctly, but the problem remains. Only with a new terminal instance the problem is gone.
#!/bin/bash
getAspect () {
aspectR=$(
mplayer -vo null -nosound "$1" 2>&1 |
while read line; do # wait until mplayer prints aspect infos or starts to play
[[ $line =~ Aspe[ck]t.is.*1.33:1 ]] && echo 1 && break
[[ $line =~ Aspe[ck]t.is.*0.56:1 ]] || [[ $line =~ Aspe[ck]t.is.*1.78:1 ]] && echo 2 && break
[[ $line == "VO: [null]"* ]] && echo 0 && break
done
pkill -n mplayer
)
return $aspectR # returns 1 (4:3), 2 (16:9) or 0 (no aspect ratio)
}
getAspect "./NameOfAMovieFile"
I could narrow down the problem to the following:
Using the mplayer output (see below) I inserted another test [[ $line =~ such ]] && echo 9 && break
in the loop to sequentially check at which line the problem started.
Result: Line 4 (LIRC). If the test matched any line before, the problem didn't occur, else it did.
Saving the mplayer output to file and replacing mplayer with cat "saved_output"
in the function didn't raise the problem.
So where does the error lie?
Is it a bug in the function, mplayer producing some weird output, bash or my terminal programs (tested with Konsole and Yakuake)?
How can I fix this?
# mplayer -vo null -nosound "./NameOfAMovieFile" 2>&1
MPlayer 1.2.r38008-Packman-8 (C) 2000-2017 MPlayer Team
do_connect: could not connect to socket
connect: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.
Playing ./NameOfAMovieFile.
libavformat version 58.12.100 (external)
libavformat file format detected.
[lavf] stream 0: video (h264), -vid 0
[lavf] stream 1: audio (vorbis), -aid 0, -alang eng
VIDEO: [H264] 1280x720 0bpp 29.970 fps 0.0 kbps ( 0.0 kbyte/s)
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
libavcodec version 58.18.100 (external)
Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
==========================================================================
Clip info:
COMPATIBLE_BRANDS: iso6avc1mp41
MAJOR_BRAND: dash
MINOR_VERSION: 0
ENCODER: Lavf57.71.100
Load subtitles in ./
Audio: no sound
Starting playback...
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
VO: [null] 1280x720 => 1280x720 Planar YV12 [zoom]
V: 0.0 0/ 0 ??% ??% ??,?% 0 0 [J
V: 0.0 0/ 0 ??% ??% ??,?% 0 0 [J
MPlayer interrupted by signal 2 in module: sleep_timer
V: 3.1 0/ 0 19% 0% 0.0% 0 0 [J
Exiting... (Quit)
My system: OpenSuse TumbleWeed, KDE
bash shell-script mplayer
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have a very strange behaviour with the script below. It executes properly, but after that anything I type at the prompt is recognized, but not displayed. So I can type another command or use the arrow buttons to select one from the history, but the prompt remains empty. If I execute the new, invisible command, the command output is displayed correctly, but the problem remains. Only with a new terminal instance the problem is gone.
#!/bin/bash
getAspect () {
aspectR=$(
mplayer -vo null -nosound "$1" 2>&1 |
while read line; do # wait until mplayer prints aspect infos or starts to play
[[ $line =~ Aspe[ck]t.is.*1.33:1 ]] && echo 1 && break
[[ $line =~ Aspe[ck]t.is.*0.56:1 ]] || [[ $line =~ Aspe[ck]t.is.*1.78:1 ]] && echo 2 && break
[[ $line == "VO: [null]"* ]] && echo 0 && break
done
pkill -n mplayer
)
return $aspectR # returns 1 (4:3), 2 (16:9) or 0 (no aspect ratio)
}
getAspect "./NameOfAMovieFile"
I could narrow down the problem to the following:
Using the mplayer output (see below) I inserted another test [[ $line =~ such ]] && echo 9 && break
in the loop to sequentially check at which line the problem started.
Result: Line 4 (LIRC). If the test matched any line before, the problem didn't occur, else it did.
Saving the mplayer output to file and replacing mplayer with cat "saved_output"
in the function didn't raise the problem.
So where does the error lie?
Is it a bug in the function, mplayer producing some weird output, bash or my terminal programs (tested with Konsole and Yakuake)?
How can I fix this?
# mplayer -vo null -nosound "./NameOfAMovieFile" 2>&1
MPlayer 1.2.r38008-Packman-8 (C) 2000-2017 MPlayer Team
do_connect: could not connect to socket
connect: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.
Playing ./NameOfAMovieFile.
libavformat version 58.12.100 (external)
libavformat file format detected.
[lavf] stream 0: video (h264), -vid 0
[lavf] stream 1: audio (vorbis), -aid 0, -alang eng
VIDEO: [H264] 1280x720 0bpp 29.970 fps 0.0 kbps ( 0.0 kbyte/s)
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
libavcodec version 58.18.100 (external)
Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
==========================================================================
Clip info:
COMPATIBLE_BRANDS: iso6avc1mp41
MAJOR_BRAND: dash
MINOR_VERSION: 0
ENCODER: Lavf57.71.100
Load subtitles in ./
Audio: no sound
Starting playback...
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
VO: [null] 1280x720 => 1280x720 Planar YV12 [zoom]
V: 0.0 0/ 0 ??% ??% ??,?% 0 0 [J
V: 0.0 0/ 0 ??% ??% ??,?% 0 0 [J
MPlayer interrupted by signal 2 in module: sleep_timer
V: 3.1 0/ 0 19% 0% 0.0% 0 0 [J
Exiting... (Quit)
My system: OpenSuse TumbleWeed, KDE
bash shell-script mplayer
I have a very strange behaviour with the script below. It executes properly, but after that anything I type at the prompt is recognized, but not displayed. So I can type another command or use the arrow buttons to select one from the history, but the prompt remains empty. If I execute the new, invisible command, the command output is displayed correctly, but the problem remains. Only with a new terminal instance the problem is gone.
#!/bin/bash
getAspect () {
aspectR=$(
mplayer -vo null -nosound "$1" 2>&1 |
while read line; do # wait until mplayer prints aspect infos or starts to play
[[ $line =~ Aspe[ck]t.is.*1.33:1 ]] && echo 1 && break
[[ $line =~ Aspe[ck]t.is.*0.56:1 ]] || [[ $line =~ Aspe[ck]t.is.*1.78:1 ]] && echo 2 && break
[[ $line == "VO: [null]"* ]] && echo 0 && break
done
pkill -n mplayer
)
return $aspectR # returns 1 (4:3), 2 (16:9) or 0 (no aspect ratio)
}
getAspect "./NameOfAMovieFile"
I could narrow down the problem to the following:
Using the mplayer output (see below) I inserted another test [[ $line =~ such ]] && echo 9 && break
in the loop to sequentially check at which line the problem started.
Result: Line 4 (LIRC). If the test matched any line before, the problem didn't occur, else it did.
Saving the mplayer output to file and replacing mplayer with cat "saved_output"
in the function didn't raise the problem.
So where does the error lie?
Is it a bug in the function, mplayer producing some weird output, bash or my terminal programs (tested with Konsole and Yakuake)?
How can I fix this?
# mplayer -vo null -nosound "./NameOfAMovieFile" 2>&1
MPlayer 1.2.r38008-Packman-8 (C) 2000-2017 MPlayer Team
do_connect: could not connect to socket
connect: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.
Playing ./NameOfAMovieFile.
libavformat version 58.12.100 (external)
libavformat file format detected.
[lavf] stream 0: video (h264), -vid 0
[lavf] stream 1: audio (vorbis), -aid 0, -alang eng
VIDEO: [H264] 1280x720 0bpp 29.970 fps 0.0 kbps ( 0.0 kbyte/s)
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
libavcodec version 58.18.100 (external)
Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
==========================================================================
Clip info:
COMPATIBLE_BRANDS: iso6avc1mp41
MAJOR_BRAND: dash
MINOR_VERSION: 0
ENCODER: Lavf57.71.100
Load subtitles in ./
Audio: no sound
Starting playback...
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
VO: [null] 1280x720 => 1280x720 Planar YV12 [zoom]
V: 0.0 0/ 0 ??% ??% ??,?% 0 0 [J
V: 0.0 0/ 0 ??% ??% ??,?% 0 0 [J
MPlayer interrupted by signal 2 in module: sleep_timer
V: 3.1 0/ 0 19% 0% 0.0% 0 0 [J
Exiting... (Quit)
My system: OpenSuse TumbleWeed, KDE
bash shell-script mplayer
bash shell-script mplayer
asked Oct 7 at 14:04
casiosmu
1013
1013
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
It's because when you kill the script by Ctrl+C, terminal send SIGINT to foreground process group leader (in your case, bash process is the leader), but it doesn't pass to subshell process by default.
You can put trap "kill 0" SIGINT;
on top of script, e.g.:
#!/bin/bash
trap "kill 0" SIGINT;
mplayer -vo null foo.mkv 2>&1 | while read line; do echo "$line"; done
Or do this in one-liner command:
bash -c 'trap "kill 0" SIGINT; mplayer -vo null foo.mkv 2>&1 | while read line; do echo "$line"; done'
Killing 0 sends the signal to all processes in the current process group. Credit.
When mplayer subshell terminated without SIGINT then its shell will not reset stty echoing. You can type stty echo
(invisible in your case) and press Enter to enable back echoing visibility manually.
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
It's because when you kill the script by Ctrl+C, terminal send SIGINT to foreground process group leader (in your case, bash process is the leader), but it doesn't pass to subshell process by default.
You can put trap "kill 0" SIGINT;
on top of script, e.g.:
#!/bin/bash
trap "kill 0" SIGINT;
mplayer -vo null foo.mkv 2>&1 | while read line; do echo "$line"; done
Or do this in one-liner command:
bash -c 'trap "kill 0" SIGINT; mplayer -vo null foo.mkv 2>&1 | while read line; do echo "$line"; done'
Killing 0 sends the signal to all processes in the current process group. Credit.
When mplayer subshell terminated without SIGINT then its shell will not reset stty echoing. You can type stty echo
(invisible in your case) and press Enter to enable back echoing visibility manually.
add a comment |
up vote
0
down vote
It's because when you kill the script by Ctrl+C, terminal send SIGINT to foreground process group leader (in your case, bash process is the leader), but it doesn't pass to subshell process by default.
You can put trap "kill 0" SIGINT;
on top of script, e.g.:
#!/bin/bash
trap "kill 0" SIGINT;
mplayer -vo null foo.mkv 2>&1 | while read line; do echo "$line"; done
Or do this in one-liner command:
bash -c 'trap "kill 0" SIGINT; mplayer -vo null foo.mkv 2>&1 | while read line; do echo "$line"; done'
Killing 0 sends the signal to all processes in the current process group. Credit.
When mplayer subshell terminated without SIGINT then its shell will not reset stty echoing. You can type stty echo
(invisible in your case) and press Enter to enable back echoing visibility manually.
add a comment |
up vote
0
down vote
up vote
0
down vote
It's because when you kill the script by Ctrl+C, terminal send SIGINT to foreground process group leader (in your case, bash process is the leader), but it doesn't pass to subshell process by default.
You can put trap "kill 0" SIGINT;
on top of script, e.g.:
#!/bin/bash
trap "kill 0" SIGINT;
mplayer -vo null foo.mkv 2>&1 | while read line; do echo "$line"; done
Or do this in one-liner command:
bash -c 'trap "kill 0" SIGINT; mplayer -vo null foo.mkv 2>&1 | while read line; do echo "$line"; done'
Killing 0 sends the signal to all processes in the current process group. Credit.
When mplayer subshell terminated without SIGINT then its shell will not reset stty echoing. You can type stty echo
(invisible in your case) and press Enter to enable back echoing visibility manually.
It's because when you kill the script by Ctrl+C, terminal send SIGINT to foreground process group leader (in your case, bash process is the leader), but it doesn't pass to subshell process by default.
You can put trap "kill 0" SIGINT;
on top of script, e.g.:
#!/bin/bash
trap "kill 0" SIGINT;
mplayer -vo null foo.mkv 2>&1 | while read line; do echo "$line"; done
Or do this in one-liner command:
bash -c 'trap "kill 0" SIGINT; mplayer -vo null foo.mkv 2>&1 | while read line; do echo "$line"; done'
Killing 0 sends the signal to all processes in the current process group. Credit.
When mplayer subshell terminated without SIGINT then its shell will not reset stty echoing. You can type stty echo
(invisible in your case) and press Enter to enable back echoing visibility manually.
answered Nov 27 at 21:36
林果皞
2,2781230
2,2781230
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f473787%2fkonsole-dont-show-typed-input-after-parsing-mplayer-output%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown