Read and store the last line of the command line output of mplayer
I am writing a program to get the output of the video length played (time in seconds) in mplayer. Usually the output of mplayer is
Playing video.mp4.
Detected file format: QuickTime / MOV (libavformat)
[lavf] stream 0: video (h264), -vid 0
Clip info:
major_brand: dash
minor_version: 0
compatible_brands: iso6avc1mp41
creation_time: 2017-11-03 00:36:26
Load subtitles in .
Selected video codec: H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 [libavcodec]
Starting playback...
VIDEO: 1920x1080 23.976 fps 1343.8 kbps (168.0 kB/s)
VO: [x11] 1920x1080 => 1920x1080 Planar YV12
[swscaler @ 0xb5cea980]No accelerated colorspace conversion found from yuv420p to bgra.
[swscaler @ 0xb5cea980]using unscaled yuv420p -> bgra special converter
Colorspace details not fully supported by selected vo.
V: 78.0 0/ 0 8% 117% 0.0% 0 0
I want the time output of the last line.
i.e.78.0
I am saving the logs in a file using this command:
mplayer video.mp4 2>timing.log | grep V:
Which will be read by the python function running in parallel to the Thread function playing the same video.
Is there any way where I can store only the timings.
As I am unable to get the timings from the log file, as it returns me null.
linux mplayer
add a comment |
I am writing a program to get the output of the video length played (time in seconds) in mplayer. Usually the output of mplayer is
Playing video.mp4.
Detected file format: QuickTime / MOV (libavformat)
[lavf] stream 0: video (h264), -vid 0
Clip info:
major_brand: dash
minor_version: 0
compatible_brands: iso6avc1mp41
creation_time: 2017-11-03 00:36:26
Load subtitles in .
Selected video codec: H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 [libavcodec]
Starting playback...
VIDEO: 1920x1080 23.976 fps 1343.8 kbps (168.0 kB/s)
VO: [x11] 1920x1080 => 1920x1080 Planar YV12
[swscaler @ 0xb5cea980]No accelerated colorspace conversion found from yuv420p to bgra.
[swscaler @ 0xb5cea980]using unscaled yuv420p -> bgra special converter
Colorspace details not fully supported by selected vo.
V: 78.0 0/ 0 8% 117% 0.0% 0 0
I want the time output of the last line.
i.e.78.0
I am saving the logs in a file using this command:
mplayer video.mp4 2>timing.log | grep V:
Which will be read by the python function running in parallel to the Thread function playing the same video.
Is there any way where I can store only the timings.
As I am unable to get the timings from the log file, as it returns me null.
linux mplayer
add a comment |
I am writing a program to get the output of the video length played (time in seconds) in mplayer. Usually the output of mplayer is
Playing video.mp4.
Detected file format: QuickTime / MOV (libavformat)
[lavf] stream 0: video (h264), -vid 0
Clip info:
major_brand: dash
minor_version: 0
compatible_brands: iso6avc1mp41
creation_time: 2017-11-03 00:36:26
Load subtitles in .
Selected video codec: H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 [libavcodec]
Starting playback...
VIDEO: 1920x1080 23.976 fps 1343.8 kbps (168.0 kB/s)
VO: [x11] 1920x1080 => 1920x1080 Planar YV12
[swscaler @ 0xb5cea980]No accelerated colorspace conversion found from yuv420p to bgra.
[swscaler @ 0xb5cea980]using unscaled yuv420p -> bgra special converter
Colorspace details not fully supported by selected vo.
V: 78.0 0/ 0 8% 117% 0.0% 0 0
I want the time output of the last line.
i.e.78.0
I am saving the logs in a file using this command:
mplayer video.mp4 2>timing.log | grep V:
Which will be read by the python function running in parallel to the Thread function playing the same video.
Is there any way where I can store only the timings.
As I am unable to get the timings from the log file, as it returns me null.
linux mplayer
I am writing a program to get the output of the video length played (time in seconds) in mplayer. Usually the output of mplayer is
Playing video.mp4.
Detected file format: QuickTime / MOV (libavformat)
[lavf] stream 0: video (h264), -vid 0
Clip info:
major_brand: dash
minor_version: 0
compatible_brands: iso6avc1mp41
creation_time: 2017-11-03 00:36:26
Load subtitles in .
Selected video codec: H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 [libavcodec]
Starting playback...
VIDEO: 1920x1080 23.976 fps 1343.8 kbps (168.0 kB/s)
VO: [x11] 1920x1080 => 1920x1080 Planar YV12
[swscaler @ 0xb5cea980]No accelerated colorspace conversion found from yuv420p to bgra.
[swscaler @ 0xb5cea980]using unscaled yuv420p -> bgra special converter
Colorspace details not fully supported by selected vo.
V: 78.0 0/ 0 8% 117% 0.0% 0 0
I want the time output of the last line.
i.e.78.0
I am saving the logs in a file using this command:
mplayer video.mp4 2>timing.log | grep V:
Which will be read by the python function running in parallel to the Thread function playing the same video.
Is there any way where I can store only the timings.
As I am unable to get the timings from the log file, as it returns me null.
linux mplayer
linux mplayer
asked Jan 15 at 10:28
ron123456ron123456
207
207
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
You are redirecting the stderr Output (2> timing.log) of mplayer only.
The 'V:' Values you are initerested in are in the stdout (1> timing.log).
Anyway I would use a cup of tee IMHO:
mplayer video.mp4 | tee -a timing.log;
grep 'V:' timing.log
It prints all the data other than the last line.
– ron123456
Jan 16 at 5:30
Although using 'strace' I was able to do so. But it slowed my raspberry pi.strace mplayer video.mp4 2>&1 | grep V: | awk 'FNR=1 {print $3}' > timing.log
– ron123456
Jan 16 at 5:31
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
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%2fsuperuser.com%2fquestions%2f1394451%2fread-and-store-the-last-line-of-the-command-line-output-of-mplayer%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You are redirecting the stderr Output (2> timing.log) of mplayer only.
The 'V:' Values you are initerested in are in the stdout (1> timing.log).
Anyway I would use a cup of tee IMHO:
mplayer video.mp4 | tee -a timing.log;
grep 'V:' timing.log
It prints all the data other than the last line.
– ron123456
Jan 16 at 5:30
Although using 'strace' I was able to do so. But it slowed my raspberry pi.strace mplayer video.mp4 2>&1 | grep V: | awk 'FNR=1 {print $3}' > timing.log
– ron123456
Jan 16 at 5:31
add a comment |
You are redirecting the stderr Output (2> timing.log) of mplayer only.
The 'V:' Values you are initerested in are in the stdout (1> timing.log).
Anyway I would use a cup of tee IMHO:
mplayer video.mp4 | tee -a timing.log;
grep 'V:' timing.log
It prints all the data other than the last line.
– ron123456
Jan 16 at 5:30
Although using 'strace' I was able to do so. But it slowed my raspberry pi.strace mplayer video.mp4 2>&1 | grep V: | awk 'FNR=1 {print $3}' > timing.log
– ron123456
Jan 16 at 5:31
add a comment |
You are redirecting the stderr Output (2> timing.log) of mplayer only.
The 'V:' Values you are initerested in are in the stdout (1> timing.log).
Anyway I would use a cup of tee IMHO:
mplayer video.mp4 | tee -a timing.log;
grep 'V:' timing.log
You are redirecting the stderr Output (2> timing.log) of mplayer only.
The 'V:' Values you are initerested in are in the stdout (1> timing.log).
Anyway I would use a cup of tee IMHO:
mplayer video.mp4 | tee -a timing.log;
grep 'V:' timing.log
answered Jan 15 at 11:59
stefan123tstefan123t
33
33
It prints all the data other than the last line.
– ron123456
Jan 16 at 5:30
Although using 'strace' I was able to do so. But it slowed my raspberry pi.strace mplayer video.mp4 2>&1 | grep V: | awk 'FNR=1 {print $3}' > timing.log
– ron123456
Jan 16 at 5:31
add a comment |
It prints all the data other than the last line.
– ron123456
Jan 16 at 5:30
Although using 'strace' I was able to do so. But it slowed my raspberry pi.strace mplayer video.mp4 2>&1 | grep V: | awk 'FNR=1 {print $3}' > timing.log
– ron123456
Jan 16 at 5:31
It prints all the data other than the last line.
– ron123456
Jan 16 at 5:30
It prints all the data other than the last line.
– ron123456
Jan 16 at 5:30
Although using 'strace' I was able to do so. But it slowed my raspberry pi.
strace mplayer video.mp4 2>&1 | grep V: | awk 'FNR=1 {print $3}' > timing.log– ron123456
Jan 16 at 5:31
Although using 'strace' I was able to do so. But it slowed my raspberry pi.
strace mplayer video.mp4 2>&1 | grep V: | awk 'FNR=1 {print $3}' > timing.log– ron123456
Jan 16 at 5:31
add a comment |
Thanks for contributing an answer to Super User!
- 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%2fsuperuser.com%2fquestions%2f1394451%2fread-and-store-the-last-line-of-the-command-line-output-of-mplayer%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