[FFmpeg-user] How to download and transcode video stream to mp4 and save the TS stream to file at the same time?

Bo Berglund bo.berglund at gmail.com
Mon Sep 30 19:03:00 EEST 2024


On Mon, 30 Sep 2024 20:36:04 +0530, Gyan Doshi <ffmpeg at gyani.pro> wrote:

>
>
>On 2024-09-30 05:46 pm, Bo Berglund wrote:
>> On Mon, 30 Sep 2024 13:40:44 +0530, Gyan Doshi<ffmpeg at gyani.pro>  wrote:
>>
>>>
>>> On 2024-09-30 01:34 pm, Bo Berglund wrote:
>>>> I checked with CharGPT and got the following:
>>>>
>>>> [quote]
>>>> The hybrid_fragmented flag was added to FFmpeg in version 6.0, released on June
>>>> 5, 2024. This feature allows for the creation of hybrid
>>>> fragmented/non-fragmented MP4 files, which can be useful for ensuring file
>>>> readability even if writing is interrupted
>>>> [/quote]
>>> This is wrong. The flag is not in any existing build. It will be in 7.1
>>> due to be released within a day or so.
>>>
>>> Regards,
>>> Gyan
>> Strange, when I go to the official website:
>>
>> https://www.ffmpeg.org/ffmpeg-all.html#Options-56
>>
>> then I find a section about this flag in "21.4.2 Options"...
>>
>> movflags -> hybrid_fragmented
>
>Sorry, that was a typo. s/existing build/existing release. But anyway, 
>7.1 was released a few minutes after I sent that reply. It's in there. 
>Regards, Gyan

OK, so in that case back to how one can get it onto ones Linux system?

I have now also tried on a Raspberry-Pi5B, which runs the fully updated most
recent operating system PiOS (Debian based, I guess).

I did a test with this:
- sudo apt update (showed 190 packages to upgrade)
- sudo apt full-upgrade (this upgraded ffmpeg too)

Then I made a copy of my stream download script where I added the extra
parameters to the ffmpeg call at the end just before the output file name:
-movflags +frag_keyframe+hybrid_fragmented 

Everything else untouched.
Then I used the script to download a 30 s test sequence.
But then ffmpeg threw and error and quit with this at the end of the run:

[mov/mp4/tgp/psp/tg2/ipod/ismv/f4v muxer @ 0x55559f9f4fb0] [Eval @
0x7ffffa717520] Undefined constant or missing '(' in 'hybrid_fragmented'
[mov/mp4/tgp/psp/tg2/ipod/ismv/f4v muxer @ 0x55559f9f4fb0] Unable to parse
option value "hybrid_fragmented"
[mov/mp4/tgp/psp/tg2/ipod/ismv/f4v muxer @ 0x55559f9f4fb0] Error setting option
movflags to value +frag_keyframe+hybrid_fragmented.
Could not write header for output file #0 (incorrect codec parameters ?):
Invalid argument
Error initializing output stream 0:0 --

So clearly this version of ffmpeg does not support the argument.

Output starts with this:
ffmpeg version 5.1.6-0+deb12u1+rpt1 Copyright (c) 2000-2024 the FFmpeg
developers
built with gcc 12 (Debian 12.2.0-14)

So is there a way (not involving self-compiling ffmpeg) to get the latest
version on board?

Just wait some weeks perhaps?


-- 
Bo Berglund
Developer in Sweden



More information about the ffmpeg-user mailing list