ffmpeg конвертирует m4s в mp4

Я работаю над DASH, пытаясь оптимизировать QoE для конечного пользователя.

У меня было видео, и я закодировал его с помощью ffmpeg в разные битрейты, и все в порядке, и видео воспроизводится с помощью dash.

Я хочу объединить полученные сегменты от пользователей в один m4 и преобразовать этот m4 в mp4.

Я пробовал много способов в ffmpeg, но он всегда дает мне эту ошибку:

[mov,mp4,m4a,3gp,3g2,mj2 @ 0x9a9e500] could not find corresponding track id 1
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x9a9e500] could not find corresponding trex
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x9a9e500] error reading header
test2.m4s: Invalid data found when processing input

Сегмент_1.m4s есть.

Как я могу решить эту проблему?


person programming freak    schedule 08.10.2018    source источник
comment
Вам не хватает фрагмента инициализации в начале файла.   -  person szatmary    schedule 08.10.2018
comment
@szatmary Я сам кодировал видео, и 38 сегментов — это все, что у меня получилось. все они объединены в этот файл m4s, где должен быть сегмент инициализации?   -  person programming freak    schedule 09.10.2018


Ответы (2)


Это работает

Объедините сегменты m4s вместе в один файл, убедившись, что порядок файлов правильный. Например.

cat video-0.m4s >> all.m4s
cat video-1.m4s >> all.m4s
cat video-2.m4s >> all.m4s
cat video-3.m4s >> all.m4s
cat video-4.m4s >> all.m4s
cat video-5.m4s >> all.m4s
cat video-6.m4s >> all.m4s
cat video-7.m4s >> all.m4s
cat video-8.m4s >> all.m4s
cat video-9.m4s >> all.m4s
cat video-10.m4s >> all.m4s

А затем сделать все ваши преобразования сразу.

ffmpeg -i all.m4s -c copy video.mp4

Это не

Я получаю ту же проблему (could not find corresponding trex), пытаясь использовать метод потоковой передачи.

У меня были все файлы, которые я хотел, в файле all.txt, который содержал

file 'video-0.m4s'
file 'video-1.m4s'
file 'video-2.m4s'
file 'video-3.m4s'
file 'video-4.m4s'
file 'video-5.m4s'
file 'video-6.m4s'
file 'video-7.m4s'
file 'video-8.m4s'
file 'video-9.m4s'
file 'video-10.m4s'

И я попробовал ffmpeg -f concat -safe 0 -i all.txt -c copy video.mp4, что привело к той же проблеме.

[mov,mp4,m4a,3gp,3g2,mj2 @ 0x55fde2d0c520] Could not find codec parameters for stream 0 (Video: h264 (avc1 / 0x31637661), none, 1280x720): unspecified pixel format
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x55fde2d0c520] Auto-inserting h264_mp4toannexb bitstream filter
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x55fde2d0c520] could not find corresponding track id 1
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x55fde2d0c520] could not find corresponding trex
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x55fde2d0c520] error reading header
[concat @ 0x55fde2cff900] Impossible to open 'rifle-1.m4s'
[concat @ 0x55fde2cff900] Could not find codec parameters for stream 0 (Video: h264 (avc1 / 0x31637661), none, 1280x720): unspecified pixel format
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, concat, from 'all.txt':
[... omitted ...]
all.txt: Input/output error
person sunapi386    schedule 26.10.2019
comment
Да, такая же проблема, все файлы в одном месте, но все равно выдает ошибку - person programming freak; 31.01.2020
comment
Как насчет сегмента инициализации? что нужно сделать для инициализации сегмента? - person user8783065; 24.03.2020
comment
@user8783065 user8783065 вы объединяете файлы m4s после сегмента инициализации, я делаю for x in *.dash *.m4s; do cat $x >> output.mp4; done, где сегмент инициализации представляет собой файл .dash - person Louis Maddox; 16.02.2021

Первый файл, который будет объединен с сегментом инициализации, за которым следует другой файл сегмента.

виндовс пауэршелл:

Сортировка и список видеофайлов

 Get-ChildItem -name v1*.m4s| Sort-Object { [regex]::Replace($_, '\d+', { $args[0].Value.PadLeft(20) }) } > list.txt

Аудио файлы

 Get-ChildItem -name a1*.m4s| Sort-Object { [regex]::Replace($_, '\d+', { $args[0].Value.PadLeft(20) }) } > list.txt

(см.: Как сортировать по имени файла так же, как это делает Windows Explorer?)

 type *init*.mp4 list.txt > Filename.mp4

Линукс:

 ls -1v v1*.m4s > list.txt
 cat *init*.mp4 list.txt > Filename.mp4
person mail2subhajit    schedule 28.10.2019
comment
Пожалуйста, проверьте, присутствуют ли все ваши данные в init.mp4 - sps,pps и т.д. - person mail2subhajit; 04.02.2020