Score:0

File size barely changing with compression; Is this how compression(encoding?) performs, as expected?

jp flag

Answered

Newbie here, this board has helped me leagues so far, thanks for that.

My request today is for those more seasoned with this sort of thing to point out any areas I might be making mistakes in, and particularly whether the end result should/should not be a surprise given the steps I've done. My objective with this is capturing and archiving a stream.


Feel free to skip to the question below, explanation to follow now:

A quick note that for the stream capture, I'm using a program which automates the process. Namely, its function is to record when there is activity on the channel, as I don't have the knowledge to write some script to automatically check whether a stream is live or not.

The source stream is of the MPEG-TS container type. That is to say, using the below, my resulting files have a .ts file extension. With the source(and output) parameters automatically handled by this program, I pass in these arguments in its FFmpeg-parameters settings:

-c:v copy -c:a copy -movflags faststart -y -f mpegts

After renaming that output by hand to let's say "file1.ts", I then use the console and execute this command:

ffmpeg -i file1.ts -c:v libx265 -crf 16 -preset slow -pix_fmt yuv420p10le -c:a aac -b:a 192k date_10bit.mp4

Here, I'm intending to re-encode the captured stream as a an HEVC/x265 file inside an .mp4 container.

  • I've set the CRF value to 16 for the reasons I'm about to mention below, but at its core I'm chasing visual in-distinction to the source, and willing to pay the price in size(or so I thought)
  • Preset set to slow at the reccommendation of some users, consensus seems to be for x265 quality of slow is equivalent to quality of medium when using x264
  • 10bit depth, because of mention that 10bit compresses better, figured I'd give it a try
  • Encoding audio to aac and 192k out of generic interest in higher quality audio availability where possible.

After many hours running, the resulting file was not visually indiscernible(didn't appear worse, as artefacts/motion issues go, but I think the 10bit command made the image noticeably more warm), and was marginally smaller than the original .ts I started with.

This was a stark lesson I'd somehow missed so far, that all re-encoding/compression(aside a CRF/QP of 0?) will always be a reduction in quality from the "source".

At day's end, my source file was 5.5GB. The x265 encode took the entire day, and popped out a file at 5.25GB. I assume because of such a low CRF namely. At any rate,


With my journey now explained:

Is all of this to be expected?

More specifically, is there(and what is) there some method to appreciably reduce file size while retaining quality- say, a CRF value of 20 or so. Currently I'm dreading the encode time, and really not seeing much positive results, so I'm inclined to accept I'll need to store the base .ts files and call it a day.

Thank you for taking the time to read.

Edit: Thank you Nmath in the comments!

guiverc avatar
cn flag
How does this relate to this site? See https://askubuntu.com/help/on-topic No OS or release or product details are provided, so why ask here?
Nmath avatar
ng flag
It sounds like your source file is already encoded/compressed, so switching to a different form of compression is probably not going to make a huge difference in the file size.
ACuriousMind avatar
jp flag
@guiverc I'll ammend as needed, but after seeing a number of posts about this exact topic with an equal amount of information disclosed I'd assumed safety. Most of them were from years past admittedly, perhaps there's been a policy change.
ACuriousMind avatar
jp flag
@Nmath Ah, so it's likely that the .ts stream I'm capturing is coming from an already compressed source, then?
Nmath avatar
ng flag
It's not clear how you are capturing this video, but video files are almost always encoded and compressed. Searching about MPEG-TS and `.ts` files indicate that the format is compressed/encoded.
ACuriousMind avatar
jp flag
@Nmath I suppose that makes sense, I should have expected that most if not all streaming services would seek to compress files before sending them out. Curious though, if for streaming efficiency most content online is already compressed, I wonder what the practical need for compression is outside DVD/Blu-Ray business. Regardless, thank you!
andrew.46 avatar
in flag
@ACuriousMind It might be better to post the results of your initial stream capture file as: `ffmpeg -i stream_capture`, giving both the command and the full terminal output in your question. Then a suitable command line for the subsequent conversion can be suggested with some precision...
cn flag
Ray
Regarding your comment about a "practical need for compression [of video]", perhaps there isn't a need for the average person. But Linux/Ubuntu (thankfully) has these tools there if you need them. But yes, as others have mentioned, you can't compress a compressed file. If you can, then the first compression method "failed" (i.e., it didn't find all the redundancy that coudl be found).
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.