Re: [FFmpeg-user] Combining download of ts stream with geometry modification into mp4?

2021-04-19 Thread Bo Berglund
On Mon, 19 Apr 2021 10:01:47 -0700, Carl Zwanzig  wrote:

>On 4/19/2021 4:46 AM, Bo Berglund wrote:
>>> *assuming that the source is producing a ts which is captured as-is
>> I think that it is,
>
>Which would be easily answered by including the command output (which should 
>have been in the initial email).
>
>
>Have you tried simply replacing
>   -i 
>with
>   -user_agent \"Mozilla\" -i  -t 
>?
>
>If that does not work, post the complete command and output (and don't use 
>-hide_banner). And, of course, use a current build of ffmpeg.

Well after my last post I checked if just adding the second command arguments
after the input had been defined to be the stream it worked just like I want it
to! :)

Here is the basics of the script I call from the at schedule at preset times
(I have removed input argument checking for clarity):

#!/bin/bash
read VIDEOURL < $URLFILE  #URLFILE contains the long URL to the 24 hour stream
CAPTURETIME="$1"  #Time in second for the capture duration
TARGETFILE="$2"  #The output file to store the video into, extension is .mp4
eval "ffmpeg -hide_banner -threads 1 -user_agent \"Mozilla\" -i $VIDEOURL -vf
scale=w=-4:h=360 -c:v libx264 -preset fast -crf 26 -c:a copy -t $CAPTURETIME
$TARGETFILE"

I think that the " -threads 1 " part does not work to reduce the CPU load,
though...
When I check with top I get a load that varies between 35% and 80% for the
ffmpeg PID.
But when I check the thread count for that PID it gets above 20!

Anyway, the whole thing now works OK and I get the final file at the time the
scheduled task is supposed to end.

All in all I now have a working solution that does not slow me down for
geometry/size conversion after each download as it did before. And the mp4 file
size is OK too.


-- 
Bo Berglund
Developer in Sweden

___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-user] Combining download of ts stream with geometry modification into mp4?

2021-04-19 Thread Carl Zwanzig

On 4/19/2021 4:46 AM, Bo Berglund wrote:

*assuming that the source is producing a ts which is captured as-is

I think that it is,


Which would be easily answered by including the command output (which should 
have been in the initial email).



Have you tried simply replacing
  -i 
with
  -user_agent \"Mozilla\" -i  -t 
?

If that does not work, post the complete command and output (and don't use 
-hide_banner). And, of course, use a current build of ffmpeg.


z!
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-user] repair missing audio header

2021-04-19 Thread Nicolas George
Carl Eugen Hoyos (12021-04-19):
> Why do you believe that the error message is an issue?

Because if there is no issue, there should be no error message.

A warning can be a false positive. An error message should never be.

> want to fix the error message, fixing in this case of course
> means to completely remove a broken audio frame.

Certainly not. Fixing in this case means creating a frame packet that
would decode into the same PCM data while not triggering the error.

Regards,

-- 
  Nicolas George


signature.asc
Description: PGP signature
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-user] repair missing audio header

2021-04-19 Thread Carl Eugen Hoyos
Am So., 18. Apr. 2021 um 17:54 Uhr schrieb Alexander Machev
:
>
> ffmpeg is reporting audio errors in some of my tv recordings.
>
> [mp2 @ 03956040] [error] Header missing
> [error] Error while decoding stream #0:1: Invalid data found when
> processing input

Command line and complete, uncut console output missing.

Why do you believe that the error message is an issue?
It is normal for transport streams to contain data loss and
above error message is what the missing data triggers.

> Is it possible to fix them without reencoding the whole audio stream ?

There used to be ProjectX but as said, I am not sure why you
want to fix the error message, fixing in this case of course
means to completely remove a broken audio frame.

Carl Eugen
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-user] Combining download of ts stream with geometry modification into mp4?

2021-04-19 Thread Bo Berglund
On Sun, 18 Apr 2021 23:41:59 -0700, Carl Zwanzig  wrote:

>On 4/18/2021 11:20 PM, Bo Berglund wrote:
>> Can I combine these two operations into a single ffmpeg command such that 
>> there
>> is no intermediate ts file created and the mp4 is available essentially when 
>> the
>> download completes?
>
>You can combine them, but* then the "download" will be extended by the time 
>needed to re-code the file _and_ you'll lose the ability to retry the 
>conversion if something goes up the wall. If you can afford the storage, I'd 
>definitely download and convert in separate steps.

I did not mean to first let the ts download complete into the ts file and then
start a conversion.
That can be done inside the script as a second operation following the capture.

What I really asked for is a way to let ffmpeg run the conversion with the
source not from a file but from the stream that it is downloading at the same
time.

Then since the conversion is faster than real time viewing the convert will be
essentially ready when the stream download is stopped on timeout.
Notice that I have a timeout in there to determine for how long the download is
supposed to be done:  "-t "
The download script is started at a set time via the at command in Linux and
shall end upon reaching the timout (since the stream continues).


>*assuming that the source is producing a ts which is captured as-is

I think that it is, this is the command:
ffmpeg -hide_banner -user_agent \"Mozilla\" -i URL -t 3600 -c
copy output.ts
Where URL is supplied on call as well as timeout 3600 (can be 7200 for 2 hours
etc)

>Also,
>"from 1280x720 to 640x320 px."  !=  "-vf scale=w=-4:h=$360"
>(what does the dollar sign do or is that a typo? complete output is always a 
>good idea.)
>1280/720=1.7 while 640/320=2.0, so I assume that should be 360.
I actually wrote 360 in the command example itself, the text above has the
typo...
But with an erroneous $ in front.

I copied the command from my script, which accepts the height as a parameter and
so in the actual command line it is specified as "-vf scale=w=-4:h=${VSIZE}"
When I replaced it I missed to also take out the $ char
You are right that the parameter is 360, which makes a 1280x720 conversion come
out as exactly 640x320. This should help in the internal processing of pixels.

>Have you looked at the CPU usage for each step?

Yes I have, the download itself is barely noticable whereas the conversion taxes
the CPU a lot. That is why the "-threads 1" is there to not completely lock up
the server.

So how should a command that uses the input *stream* as source to the mp4
conversion look like?


-- 
Bo Berglund
Developer in Sweden

___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-user] "vibrance" video filter, default luma coefficients swapped?

2021-04-19 Thread Jim DeLaHunt

On 2021-04-14 22:33, Jim DeLaHunt wrote:
...So, luma = 0.2126 * r + 0.7152 * g + 0.0722 * b, a value in [0.0, 
1.0] for r, g, b in [0.0, 1.0]


But the default values I see in the FFmpeg vibrance filter are[4]:

  rlum (default 0.072186), glum (default 0.715158), blum (default 
0.212656)


Thus it looks like the default values for rlum and blum are swapped



I entered ticket #9195, "vibrance (video filter) incorrect defaults for 
luma", https://trac.ffmpeg.org/ticket/9195 , to track this.


Again, thanks for contributing this "vibrance" filter. It's a nice 
feature to have.


Best regards,
    —Jim DeLaHunt

___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-user] Combining download of ts stream with geometry modification into mp4?

2021-04-19 Thread Carl Zwanzig

On 4/18/2021 11:20 PM, Bo Berglund wrote:

Can I combine these two operations into a single ffmpeg command such that there
is no intermediate ts file created and the mp4 is available essentially when the
download completes?


You can combine them, but* then the "download" will be extended by the time 
needed to re-code the file _and_ you'll lose the ability to retry the 
conversion if something goes up the wall. If you can afford the storage, I'd 
definitely download and convert in separate steps.


*assuming that the source is producing a ts which is captured as-is

Also,
"from 1280x720 to 640x320 px."  !=  "-vf scale=w=-4:h=$360"
(what does the dollar sign do or is that a typo? complete output is always a 
good idea.)

1280/720=1.7 while 640/320=2.0, so I assume that should be 360.

Have you looked at the CPU usage for each step?

Later,

z!
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-user] Combining download of ts stream with geometry modification into mp4?

2021-04-19 Thread Bo Berglund
This is about speeding up my video download process.
It runs on an Ubuntu server (no GUI on the Ubuntu machine).

So I have a working solution to do these tasks:
1) Download during a fixed time from a streaming source into a ts file
2) When done process ts file(s) into mp4 while also changing geometry from
1280x720 to 640x320 px.

The two commands used are as follows:
1) Download:
ffmpeg -hide_banner -user_agent \"Mozilla\" -i  -t  -c
copy 

The CAPTURETIME argument in seconds limits the time span of the video

2) Process geometry and file format:
ffmpeg -hide_banner -threads 1 -i  -vf scale=w=-4:h=$360 -c:v libx264
-preset fast -crf 32 -c:a copy 

To process the downloaded file takes about 30% of the playing time so for a 60
min download it takes an additional 20 minutes to process.

Question:
-
Can I combine these two operations into a single ffmpeg command such that there
is no intermediate ts file created and the mp4 is available essentially when the
download completes?

As it is now I download nightly and then I have to run a batch job in the
morning to convert all the successfully downloaded ts videos into mp4, which
takes several hours...


-- 
Bo Berglund
Developer in Sweden

___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".