LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-16-2018, 01:53 PM   #1
8JhN
LQ Newbie
 
Registered: May 2017
Posts: 13

Rep: Reputation: Disabled
Motion, saved files lower quality than live stream.


Is it possible to save video without compression?

ffplay gives this information from stream:

Stream #0:0: Video: h264 (High), yuv420p, 1920x1080, 25 fps, 15 tbr, 90k tbn, 50 tbc


I've already set ffmpeg_variable_bitrate to 100, framerate to 25, width 1920 and height 1080. Saved files are not so good than live stream

I'm using FreeBSD, but I think that's irrelevant..
 
Old 02-16-2018, 04:50 PM   #2
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,140
Blog Entries: 6

Rep: Reputation: 1828Reputation: 1828Reputation: 1828Reputation: 1828Reputation: 1828Reputation: 1828Reputation: 1828Reputation: 1828Reputation: 1828Reputation: 1828Reputation: 1828
h264 is already really good compression.
How are you saving the stream? Are you reencoding it?
If you don't want the q changed then don't reencode it.
Quote:
Is it possible to save video without compression?
Yes, it will be huge.

You can always dump the stream unchanged to file
Code:
mplayer <url> -dumpsteam -dumpfile outfile.ts
Code:
ffmpeg -i <url> -c:a copy -c:v copy output.ts
Why don't you post what you are trying to do.
 
Old 02-16-2018, 05:01 PM   #3
8JhN
LQ Newbie
 
Registered: May 2017
Posts: 13

Original Poster
Rep: Reputation: Disabled
I'm using Motion security camera software. Stream coming from IP-camera is already compressed.

This is from my config file:

# Codec to used by ffmpeg for the video compression.
# Timelapse mpegs are always made in mpeg1 format independent from this option.
# Supported formats are: mpeg1 (ffmpeg-0.4.8 only), mpeg4 (default), and msmpeg4.
# mpeg1 - gives you files with extension .mpg
# mpeg4 or msmpeg4 - gives you files with extension .avi
# msmpeg4 is recommended for use with Windows Media Player because
# it requires no installation of codec on the Windows client.
# swf - gives you a flash film with extension .swf
# flv - gives you a flash video with extension .flv
# ffv1 - FF video codec 1 for Lossless Encoding ( experimental )
# mov - QuickTime ( testing )
ffmpeg_video_codec mpeg4

I only need Motion save stream to hard disk. Here's default config.
 
Old 02-16-2018, 05:19 PM   #4
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,140
Blog Entries: 6

Rep: Reputation: 1828Reputation: 1828Reputation: 1828Reputation: 1828Reputation: 1828Reputation: 1828Reputation: 1828Reputation: 1828Reputation: 1828Reputation: 1828Reputation: 1828
How are you dumping the stream to file now? Are you reencoding it?
Are you playing the stream with ffplay? Then ffmpeg will dump it. or mplayer, mpv, vlc etc.
 
Old 02-16-2018, 05:27 PM   #5
8JhN
LQ Newbie
 
Registered: May 2017
Posts: 13

Original Poster
Rep: Reputation: Disabled
I use ffplay only to watch stream. Motion saves streams itself using config file.
 
Old 02-17-2018, 08:12 AM   #6
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,140
Blog Entries: 6

Rep: Reputation: 1828Reputation: 1828Reputation: 1828Reputation: 1828Reputation: 1828Reputation: 1828Reputation: 1828Reputation: 1828Reputation: 1828Reputation: 1828Reputation: 1828
Quote:
I use ffplay only to watch stream.
Ok, is there something in posts 2 and 4 that doesn't work for you?

Edit:
When you say that you are watching the stream with ffplay, do you mean the stream from the camera, or the file after it has been downloaded to your HD? Stream means what is coming from the camera.

If you mean a file after it has already been made, and you don't like the quality, then you'll need to configure Motion to stop encoding in poor q and make a better q.

Or grab the stream coming from the camera, with v4l, or ffmpeg, and dump to file raw, then reencode to the format that you want.
Or encode to a good format on the fly.

Quote:
Stream coming from IP-camera is already compressed.
Does that mean that it is already encoded in to a format like x264?
Then you'll need to start there.
Looked at this
http://www.linux-projects.org/downlo...es/motion.conf
Looks like it uses v4l2 and ffmpeg.
You should be able access the cam, with v4l2 then, and encode the stream however you want.
Example:
Code:
ffmpeg -f v4l2 -s 320x240 -i /dev/video0 -c:v libx264 -b:v 300k out.avi
ffplay -f v4l2 -s 320x240 -i /dev/video0
Edit2:
Look at the man pages and docs for ffmpeg and v4l2
A better q will probably be
Code:
ffmpeg -f v4l2 -s 320x240 -i /dev/video0 -crf 18 -preset slow -s 640x480 output.mp4
Not sure if you can do that on the fly though. Depends on how good a processor that you have. You may want to dump raw then reencode later.

Edit3:
Sorry, I keep finding things in my noted that will help you out.
Code:
v4l2-ctl --list-formats-ext
v4l2-ctl --list-device
ffmpeg -f video4linux2 -list_formats all -i /dev/video0

Last edited by teckk; 02-17-2018 at 09:03 AM.
 
Old 02-17-2018, 03:00 PM   #7
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by 8JhN View Post
I've already set ffmpeg_variable_bitrate to 100
that is very little.
it is a little difficult to give proper advice since you cannot (?) show us any commands, or where you actually entered that setting.
 
  


Reply

Tags
compression, motion, stream



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I embed a stream from the motion program. baronobeefdip Linux - Server 3 09-29-2014 09:17 AM
motion not doing live stream sniper8752 Linux - Software 14 11-09-2013 07:04 AM
Lower video quality with ffmpeg? anon109 Linux - General 4 03-01-2013 02:20 AM
Where do saved files go when you run a live CD? Nymn Linux - Newbie 16 07-05-2012 12:32 PM
Motion jpeg stream. Xa! Programming 2 08-29-2005 10:45 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:00 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration