Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > New and alternative a/v containers

Reply
 
Thread Tools Search this Thread Display Modes
Old 13th November 2021, 05:32   #1  |  Link
GAP
Registered User
 
Join Date: Sep 2020
Posts: 135
Are lossless .mkv files really lossless?

I found an FFMPEG script for the lossless encoding for .mkv files. The question I have is, are lossless .mkv files really lossless? Or should I stick with .mp4?
GAP is offline   Reply With Quote
Old 13th November 2021, 10:58   #2  |  Link
nevcairiel
Registered Developer
 
Join Date: Mar 2010
Location: Hamburg/Germany
Posts: 10,344
Both MKV and MP4 are just containers. If its lossless depends on what you put into them and how you handle it. In other words, its impossible to say.
__________________
LAV Filters - open source ffmpeg based media splitter and decoders
nevcairiel is offline   Reply With Quote
Old 13th November 2021, 16:16   #3  |  Link
VoodooFX
Banana User
 
VoodooFX's Avatar
 
Join Date: Sep 2008
Posts: 985
Quote:
Originally Posted by GAP View Post
The question I have is, are lossless .mkv files really lossless?
Yes they are lossless.
VoodooFX is offline   Reply With Quote
Old 13th November 2021, 17:52   #4  |  Link
kedautinh12
Registered User
 
Join Date: Jan 2018
Posts: 2,153
Quote:
Originally Posted by VoodooFX View Post
Yes they are lossless.
Really?? I download format vp9 in youtube with mkv container and you say it's lossless???
kedautinh12 is offline   Reply With Quote
Old 13th November 2021, 18:05   #5  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Quote:
I found an FFMPEG script for the lossless encoding for .mkv files.
Quote:
Yes they are lossless.
Quote:
Really??
GAP is taliking about lossless conversion to alternate container, so lossless with respect to original container [assuming that the un-supplied script does it without re-encode].

EDIT: So something like this
Code:
setlocal

REM Where to Find ffmpeg
set FFMPEG="C:\BIN\ffmpeg.exe"

REM Where to get input file, No terminating Backslash, "." = current directory
set INDIR="."


REM Where to place output file, No terminating Backslash.
set OUTDIR=".\OUTPUT"

REM Below, can add SPACE separated source extensions, eg " *.ASF".
FOR %%A IN (*.wmv *.mpg *.avi *.flv *.mov *.mp4 *.m4v *.RAM *.RM) DO (
  %FFMPEG% -i "%INDIR%\%%A" -vcodec copy    -acodec copy  "%OUTDIR%\%%~nxA.MKV"

)


Pause
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 13th November 2021 at 18:14.
StainlessS is offline   Reply With Quote
Old 13th November 2021, 18:16   #6  |  Link
VoodooFX
Banana User
 
VoodooFX's Avatar
 
Join Date: Sep 2008
Posts: 985
Quote:
Originally Posted by kedautinh12 View Post
Really?? I download format vp9 in youtube with mkv container and you say it's lossless???
Yes. Read the question carefully. There is nothing about "vp9".
I understand OP question as "Will lossless video still be lossless in mkv container?"
VoodooFX is offline   Reply With Quote
Old 25th November 2021, 18:59   #7  |  Link
GAP
Registered User
 
Join Date: Sep 2020
Posts: 135
Here is the script in question:

Code:
c:a pcm_s16le -c:v libx264rgb -qp 0 -pix_fmt rgb24 -f matroska
Quote:
I understand OP question as "Will lossless video still be lossless in mkv container?"
I guess that was what I was asking.
GAP is offline   Reply With Quote
Old 25th November 2021, 20:00   #8  |  Link
VoodooFX
Banana User
 
VoodooFX's Avatar
 
Join Date: Sep 2008
Posts: 985
Quote:
Originally Posted by GAP View Post
I guess that was what I was asking.
Yeap, you was asking that, but now you are asking different question about script.

I didn't knew it was possible to have RGB in x264. In what colorspace is your input file?
VoodooFX is offline   Reply With Quote
Old 2nd December 2021, 05:49   #9  |  Link
GAP
Registered User
 
Join Date: Sep 2020
Posts: 135
The colorspace on my videos are usually RGB according to Mediainfo.
GAP is offline   Reply With Quote
Old 4th December 2021, 01:25   #10  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
GAP,
the BAT/CMD script in post #5 will simply copy both video and audio streams into MKV, no change [both lossless, uncompressed RGB if uncompressed RGB source, x264 if x264 source etc].

Batch processes all file containers [in INDIR directory] mentioned on this line [can add containers]
Code:
REM Below, can add SPACE separated source extensions, eg " *.ASF".    # THIS LINE IS COMMENT
FOR %%A IN (*.wmv *.mpg *.avi *.flv *.mov *.mp4 *.m4v *.RAM *.RM) DO (
With destination directory OUTDIR, and output container in BLUE, ie MKV
Code:
%FFMPEG% -i "%INDIR%\%%A" -vcodec copy    -acodec copy  "%OUTDIR%\%%~nxA.MKV"
EDIT:
And if ffmpeg location is already in your environment path, then can change
Code:
REM Where to Find ffmpeg
set FFMPEG="C:\BIN\ffmpeg.exe"
to
Code:
REM Where to Find ffmpeg
set FFMPEG="ffmpeg.exe"
Or change the FFMPEG path line to wherever it lives on your system.

EDIT: May fail if SPACES or non ASCII chars in filenames/directories.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 4th December 2021 at 01:47.
StainlessS is offline   Reply With Quote
Old 18th January 2022, 20:18   #11  |  Link
Reclusive Eagle
Registered User
 
Join Date: Oct 2021
Posts: 83
Quote:
Originally Posted by kedautinh12 View Post
Really?? I download format vp9 in youtube with mkv container and you say it's lossless???
Youtube compresses so the source file that was uploaded was lossless but the file is then compressed to YouTubes standards.

MKV is a container.
It is made to store large amounts of data without compression.

The only way the video stored in MKV's loses data is if the codec is lossy.
Or if its been re-encoded multiple times.

If you render a video into an mkv using a true lossless codec.
Your source is a mirror image of the pre-rendered file.


VP9 is made for website efficiency. Any "mainstream" format made to be viewed is compressed.
So PNG 8 Bit is compressed. JPEG is normally compressed etc.

VP9 is a high efficiency codec. Not a high quality one.
If your source is a 10GB 10 min file and you encode it with VP9 it will probably be reduced to 3GB or less.
I.E Compression

Last edited by Reclusive Eagle; 18th January 2022 at 20:21.
Reclusive Eagle is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 21:43.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.