Giter Club home page Giter Club logo

Comments (10)

kqyang avatar kqyang commented on July 18, 2024

Yes, you can specify the segment_duration with --segment_duration flag, you may also want to specify --profile=live to generate live profile.

edash_packager does not purge "old" segments right now. You'll need to setup an external job to purge "old" segments periodically.

Let us know if you have further questions.

from shaka-packager.

frapontillo avatar frapontillo commented on July 18, 2024

Whops, totally missed the 1:1 match between muxer_flags and the CLI application.
BTW, weird things happen when running:

packager \
'input=udp://127.0.0.1:5001,stream=video,init_segment=live-video-640x480-1024k.mp4,segment_template=live-video-640x480-1024k-$Number$.mp4' \
'input=udp://127.0.0.1:5002,stream=video,init_segment=live-video-640x480-512k.mp4,segment_template=live-video-640x480-512k-$Number$.mp4' \
'input=udp://127.0.0.1:5003,stream=video,init_segment=live-video-320x240-1024k.mp4,segment_template=live-video-320x240-1024k-$Number$.mp4' \
'input=udp://127.0.0.1:5004,stream=video,init_segment=live-video-320x240-512k.mp4,segment_template=live-video-320x240-512k-$Number$.mp4' \
'input=udp://127.0.0.1:5005,stream=audio,init_segment=live-audio-64k.mp4,segment_template=live-audio-64k-$Number$.mp4' \
'input=udp://127.0.0.1:5006,stream=audio,init_segment=live-audio-32k.mp4,segment_template=live-audio-32k-$Number$.mp4' \
--profile live \
--segment_duration 1 \
--mpd_output live.mpd

Sometimes everything is fine, some other times "Demuxer failed to initialize: 4 (UNIMPLEMENTED): Container not supported." pops up:

[0318/185926:ERROR:demuxer.cc(78)] Not implemented reached in edash_packager::media::Status edash_packager::media::Demuxer::Initialize()
[0318/185926:ERROR:packager_main.cc(142)] Demuxer failed to initialize: 4 (UNIMPLEMENTED): Container not supported.

The UDP sources are simple MPEG2-TS streams generated via ffmpeg coming from RTSP:

ffmpeg -loglevel info -i rtsp://user:[email protected]/mpeg4/media.amp \
    -an -c:v libx264 -s 640x480 -b:v 1024k -f mpegts udp://127.0.0.1:5001 \
    -an -c:v libx264 -s 320x240 -b:v 1024k -f mpegts udp://127.0.0.1:5002 \
    -an -c:v libx264 -s 640x480 -b:v 512k -f mpegts udp://127.0.0.1:5003 \
    -an -c:v libx264 -s 320x240 -b:v 512k -f mpegts udp://127.0.0.1:5004 \
    -vn -strict -2 -ac 2 -c:a aac -b:a 64k -f mpegts udp://127.0.0.1:5005 \
    -vn -strict -2 -ac 2 -c:a aac -b:a 32k -f mpegts udp://127.0.0.1:5006

from shaka-packager.

kqyang avatar kqyang commented on July 18, 2024

That is weird. Somehow edash_packager wasn't able to auto-detect the container type. Can you apply the below patch and paster the output:

diff --git i/packager/media/base/demuxer.cc w/packager/media/base/demuxer.cc
index d30c33c..0c09b9f 100644
--- i/packager/media/base/demuxer.cc
+++ w/packager/media/base/demuxer.cc
@@ -9,6 +9,7 @@
 #include "packager/base/bind.h"
 #include "packager/base/logging.h"
 #include "packager/base/stl_util.h"
+#include "packager/base/strings/string_number_conversions.h"
 #include "packager/media/base/container_names.h"
 #include "packager/media/base/decryptor_source.h"
 #include "packager/media/base/key_source.h"
@@ -75,6 +76,8 @@ Status Demuxer::Initialize() {
       parser_.reset(new wvm::WvmMediaParser());
       break;
     default:
+      LOG(ERROR) << "Container " << container << std::endl
+                 << base::HexEncode(buffer_.get(), bytes_read);
       NOTIMPLEMENTED();
       return Status(error::UNIMPLEMENTED, "Container not supported.");
   }

from shaka-packager.

frapontillo avatar frapontillo commented on July 18, 2024

This is the output:

[0319/085722:ERROR:demuxer.cc(79)] Container 0
4741003D7300FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000001E0003E80C00A310BA5D841110BA5D1390000000109F000000001019F056A423FCE16FDAA4E03CF6779BD8ED7C2221B906BCF5E1226BADBFE8A8037A629D020B1C1
[0319/085722:ERROR:demuxer.cc(81)] Not implemented reached in edash_packager::media::Status edash_packager::media::Demuxer::Initialize()
[0319/085722:ERROR:packager_main.cc(142)] Demuxer failed to initialize: 4 (UNIMPLEMENTED): Container not supported.
[0319/085722:FATAL:simple_thread.cc(26)] Check failed: HasBeenStarted(). SimpleThread was never started.
 [0x00000068f1d0] base::debug::StackTrace::StackTrace()
 [0x0000006281ef] logging::LogMessage::~LogMessage()
 [0x0000006612e5] base::SimpleThread::~SimpleThread()
 [0x00000040ddf0] edash_packager::media::RemuxJob::~RemuxJob()
 [0x00000040de20] edash_packager::media::RemuxJob::~RemuxJob()
 [0x000000413664] STLDeleteContainerPointers<>()
 [0x000000411572] STLDeleteElements<>()
 [0x00000040fae3] STLElementDeleter<>::~STLElementDeleter()
 [0x00000040d4b8] edash_packager::media::RunPackager()
 [0x00000040d7d7] edash_packager::media::PackagerMain()
 [0x00000040d837] main
 [0x7ff2f4386ec5] __libc_start_main
 [0x00000040a669] <unknown>

Aborted (core dumped)

Another run just gave:
474100308700FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000001E0002A808005211395D5390000000109F000000001019E3C7445FF02196CE650EC5CE416181090BE59B439F7B5

EDIT: I don't know if I did the math right, but it looks like each received packet is 188 bytes, therefore the packet_length check always fails here, forcing the CheckMpeg2TransportStream method to analyze, offset by offset, all first 20 bytes, finally failing.

This issue might be related to how ffmpeg sends packets over UDP.

EDIT 2: the same thing seems to happen when converting to MPEG-TS over UDP a simple local MP4 file, so the source being RTSP can't be the issue. It's either ffmpeg or the packager doing something wrong.

from shaka-packager.

tinskip avatar tinskip commented on July 18, 2024

Your assessment of the container format determination problem seems to be right on the dot. We will make changes to address this issue.

Thanks!

from shaka-packager.

frapontillo avatar frapontillo commented on July 18, 2024

Do you have any timeline for this? If not, could you please tell me if there's another way to package a stream coming from a live source such as RTSP?

Thanks!

from shaka-packager.

kqyang avatar kqyang commented on July 18, 2024

Can you try if the below patch fix the problem?

diff --git i/packager/media/base/demuxer.cc w/packager/media/base/demuxer.cc
index d30c33c..7acadcf 100644
--- i/packager/media/base/demuxer.cc
+++ w/packager/media/base/demuxer.cc
@@ -57,10 +57,16 @@ Status Demuxer::Initialize() {
                   "Cannot open file for reading " + file_name_);
   }

-  // Determine media container.
-  int64_t bytes_read = media_file_->Read(buffer_.get(), kInitBufSize);
-  if (bytes_read <= 0)
-    return Status(error::FILE_FAILURE, "Cannot read file " + file_name_);
+  size_t bytes_read = 0;
+  while (bytes_read < kInitBufSize) {
+    int64_t read_result =
+        media_file_->Read(buffer_.get() + bytes_read, kInitBufSize);
+    if (read_result < 0)
+      return Status(error::FILE_FAILURE, "Cannot read file " + file_name_);
+    if (read_result == 0)
+      break;
+    bytes_read += read_result;
+  }
   MediaContainerName container = DetermineContainer(buffer_.get(), bytes_read);

   // Initialize media parser.

You may also try use vlc instead of ffmpeg to get the stream from a RSTP source: https://wiki.videolan.org/Documentation:Streaming_HowTo/Command_Line_Examples/

We are also considering supporting RSTP directly at some time.

from shaka-packager.

frapontillo avatar frapontillo commented on July 18, 2024

Applying the patch does the trick, excellent!
Thank you very much!

from shaka-packager.

abhi0001 avatar abhi0001 commented on July 18, 2024

i want little help on installation of edash packager...after installing docker i was not able to execute docker build -t edash github.com/google/edash-packager.git command though i executed by adding sudo at the beginning and it executed but now i am getting the following error when trying the test section can't proceed need help badly.....the error looks something like this

[1208/100637:INFO:demuxer.cc(55)] Initialize Demuxer for file '/media/example.mp4'.
[1208/100637:ERROR:packager_main.cc(250)] Demuxer failed to initialize: 5 (FILE_FAILURE): Cannot open file for reading /media/example.mp4

from shaka-packager.

kqyang avatar kqyang commented on July 18, 2024

You can config to use docker without sudo:
http://askubuntu.com/questions/477551/how-can-i-use-docker-without-sudo

Packager fails because it is not able to find example.mp4 file. Can you
make sure that you have it in /your_media_path/?

-- KongQun Yang (KQ)

On Tue, Dec 8, 2015 at 2:22 AM, abhi0001 [email protected] wrote:

i want little help on installation of edash packager...after installing
docker i was not able to execute docker build -t edash
github.com/google/edash-packager.git command though i executed by adding
sudo at the beginning and it executed but now i am getting the following
error when trying the test section can't proceed need help badly.....the
error looks something like this

[1208/100637:INFO:demuxer.cc(55)] Initialize Demuxer for file
'/media/example.mp4'.
[1208/100637:ERROR:packager_main.cc(250)] Demuxer failed to initialize: 5
(FILE_FAILURE): Cannot open file for reading /media/example.mp4


Reply to this email directly or view it on GitHub
#11 (comment)
.

from shaka-packager.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.