Generate MPEG Transport stream from audio files only

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
16 messages Options
Reply | Threaded
Open this post in threaded view
|

Generate MPEG Transport stream from audio files only

Pierre Pasquet
Hello all,

I have set up a HLS server and asked it to listen to localhost on port 5555 with this command `mediastreamsegmenter -f /Library/WebSever/Documents/live 127.0.0.1 -audio-only`. This is a macOS tool.

I have found a command to create an input stream from a **video** file and send it to the `mediastreamsegmenter`, as follow :

    ffmpeg
    -re -i video.m4v
    -vcodec copy
    -vbsf h264_mp4toannexb
    -acodec copy
    -f mpgets udp://127.0.0.1:5555

However, It doesn't work with a AAC file. How can I send an audio-only file. (I really don't care about the image) to a segmenter?

Thanks for your help,

Best,

Pierre

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Generate MPEG Transport stream from audio files only

Carl Eugen Hoyos-2
2018-03-07 19:16 GMT+01:00, Pierre Pasquet <[hidden email]>:

> However, It doesn't work with a AAC file.

Command line and complete, uncut console output missing.

Carl Eugen
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Generate MPEG Transport stream from audio files only

Pierre Pasquet
Not sure to identify what is missing. This command works for a .m4v file and doesn’t for a .aac file located in the same directory.
How can it be?

Thanks for your help,

> On 8 Mar 2018, at 11:02, Carl Eugen Hoyos <[hidden email]> wrote:
>
> 2018-03-07 19:16 GMT+01:00, Pierre Pasquet <[hidden email]>:
>
>> However, It doesn't work with a AAC file.
>
> Command line and complete, uncut console output missing.
>
> Carl Eugen
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Generate MPEG Transport stream from audio files only

Moritz Barsnick
On Thu, Mar 08, 2018 at 14:25:54 +0000, Pierre Pasquet wrote:
> Not sure to identify what is missing. This command works for a .m4v file and doesn’t for a .aac file located in the same directory.

As Carl Eugen tried to point out: What is missing is that you provide
your actual (non-working) command line and its complete, uncut console
output. These provide a lot of valuable information, and will help to
analyze your issue.

Cheers,
Moritz
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Generate MPEG Transport stream from audio files only

Pierre Pasquet
All right, here’s a detailed presentation of what’s happening :

First of all, everything is on local. I am using the default Mac OS apache server

- I launch a process that listens on port 5555 and segments incoming media for deployment using HTTP Live Streaming with :
mediastreamsegmenter -f /Library/WebServer/Documents/live 127.0.0.1:5555

In theory, when receiving an input file, the segmenter should generate a playlist .m3u8 and create subsequent .aac files (because we are dealing only with audio)

- Then, I **try** to wrap the audio in a MPEG-2 transport stream and send it over UDP to port 5555 with the following command (on a different terminal tab) :
ffmpeg -re -i test.aac -vcodec copy -vbsf h264_mp4toannexb -acodec copy -f mpegts udp://127.0.0.1:5555

At this point, here’s what happens :

- on the segmenter tab :

Mar  9 2018 00:59:49.627: audio pid set at 100
Mar  9 2018 00:59:49.928: audio pid change to 100
Mar  9 2018 00:59:50.396: audio pid change to 100
Mar  9 2018 00:59:50.718: audio pid change to 100

And so on … (same prompt)

- on the ffmpeg tab :

[aac @ 0x7fd242009400] Estimating duration from bitrate, this may be inaccurate
Input #0, aac, from 'test.aac':
  Duration: 00:01:08.37, bitrate: 139 kb/s
    Stream #0:0: Audio: aac (LC), 44100 Hz, stereo, fltp, 139 kb/s
[mpegts @ 0x7fd24200a000] frame size not set
Output #0, mpegts, to 'udp://127.0.0.1:5555':
  Metadata:
    encoder         : Lavf57.83.100
    Stream #0:0: Audio: aac (LC), 44100 Hz, stereo, fltp, 139 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
size=      75kB time=00:00:04.06 bitrate= 151.0kbits/s speed=   1x


At this point, there should be a .m3u8 playlist file under /Library/WebServer/Documents/live and appropriate .aac files. But it’s not the case.
Eventually, the ffmpeg tab will return this :

video:0kB audio:1165kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 12.020084%

And the segmenter tab will return :

Mar  9 2018 01:02:00.582: Warning: no data received for 0.5 seconds.
Mar  9 2018 01:02:01.083: Warning: no data received for 1.0 seconds.
Mar  9 2018 01:02:01.583: Warning: no data received for 1.5 seconds.
Mar  9 2018 01:02:02.084: Warning: no data received for 2.0 seconds.
Mar  9 2018 01:02:02.589: Warning: no data received for 2.5 seconds.
Mar  9 2018 01:02:03.090: Warning: no data received for 3.0 seconds.
Mar  9 2018 01:02:03.591: Warning: no data received for 3.5 seconds.
Mar  9 2018 01:02:04.095: Warning: no data received for 4.0 seconds.


But still no files were created.

I know that the ffmpeg command is not write because it applies to video files, but I can’t come up with an equivalent command for audio only!

Thanks for your help,

Pierre

> On 8 Mar 2018, at 16:17, Moritz Barsnick <[hidden email]> wrote:
>
> On Thu, Mar 08, 2018 at 14:25:54 +0000, Pierre Pasquet wrote:
>> Not sure to identify what is missing. This command works for a .m4v file and doesn’t for a .aac file located in the same directory.
>
> As Carl Eugen tried to point out: What is missing is that you provide
> your actual (non-working) command line and its complete, uncut console
> output. These provide a lot of valuable information, and will help to
> analyze your issue.
>
> Cheers,
> Moritz
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Generate MPEG Transport stream from audio files only

Carl Zwanzig
In reply to this post by Moritz Barsnick
On 3/8/2018 8:17 AM, Moritz Barsnick wrote:
> As Carl Eugen tried to point out: What is missing is that you provide
> your actual (non-working) command line and its complete, uncut console
> output.

One thing missing is some directed speculation even before the cmd line is
sent; it's a valuable part of troubleshooting and helps those asking to learn.

       
To the OP-
You might try providing dummy video to go with the audio (I know some
software doesn't deal well when there is no video stream).

I think all you need to add something like

   -i color=s=$outFormat:c=black:r=$videoRate

but I haven't tried it.

z!
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Generate MPEG Transport stream from audio files only

Moritz Barsnick
On Thu, Mar 08, 2018 at 19:51:03 -0800, Carl Zwanzig wrote:
> One thing missing is some directed speculation even before the cmd line is
> sent; it's a valuable part of troubleshooting and helps those asking to learn.

Yes and no. Speculating will help the OP avoid providing more
information. It might solve the issue and we never know why.

In this case, the complete error description was "However, It doesn't
work with a AAC file." My correct answer would have been "It works for
me" (and yes, I actually tried).

> You might try providing dummy video to go with the audio (I know some
> software doesn't deal well when there is no video stream).

But then you are ignoring the OP's original request: "How can I send an
audio-only file." I *did* speculate that the described error meant "ffmpeg
doesn't work", but it is known to work with aac audio only, so, from
the point of getting ffmpeg to work, no need to add dummy video. But
that too was directed speculation. So in all honesty: It's easier to
ask what's actually going wrong.

Moritz
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Generate MPEG Transport stream from audio files only

Moritz Barsnick
In reply to this post by Pierre Pasquet
On Fri, Mar 09, 2018 at 01:03:16 +0000, Pierre Pasquet wrote:
> In theory, when receiving an input file, the segmenter should generate a playlist .m3u8 and create subsequent .aac files (because we are dealing only with audio)
[...]
> I know that the ffmpeg command is not write because it applies to video files, but I can’t come up with an equivalent command for audio only!

Did you ever consider that mediastreamsegmenter may be the issue?

The FAQ:
https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/StreamingMediaGuide/FrequentlyAskedQuestions/FrequentlyAskedQuestions.html

    12. How can I create an audio-only stream from audio/video input?
        Add the -audio-only argument when invoking the stream or files segmenter.

Have you tried this?

Moritz
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Generate MPEG Transport stream from audio files only

Pierre Pasquet
Yes, I have tried using the -audio-only flag and it didn’t work either with an audio only file.

> On 9 Mar 2018, at 12:01, Moritz Barsnick <[hidden email]> wrote:
>
>> On Fri, Mar 09, 2018 at 01:03:16 +0000, Pierre Pasquet wrote:
>> In theory, when receiving an input file, the segmenter should generate a playlist .m3u8 and create subsequent .aac files (because we are dealing only with audio)
> [...]
>> I know that the ffmpeg command is not write because it applies to video files, but I can’t come up with an equivalent command for audio only!
>
> Did you ever consider that mediastreamsegmenter may be the issue?
>
> The FAQ:
> https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/StreamingMediaGuide/FrequentlyAskedQuestions/FrequentlyAskedQuestions.html
>
>    12. How can I create an audio-only stream from audio/video input?
>        Add the -audio-only argument when invoking the stream or files segmenter.
>
> Have you tried this?
>
> Moritz
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Generate MPEG Transport stream from audio files only

Pierre Pasquet
In reply to this post by Carl Zwanzig
Hello,

I have tried your solution and here’s what I get : Unable to find a suitable output format for 'color=s=:c=black:r='
color=s=:c=black:r=: Invalid argument


The full command was : ffmpeg -re -i test.aac color=s=$outFormat:c=black:r=$videoRate -vcodec copy -vbsf h264_mp4toannexb -acodec copy -f mpegts udp://127.0.0.1:5555 <udp://127.0.0.1:5555>

Thanks,

Pierre

> On 9 Mar 2018, at 03:51, Carl Zwanzig <[hidden email]> wrote:
>
> On 3/8/2018 8:17 AM, Moritz Barsnick wrote:
>> As Carl Eugen tried to point out: What is missing is that you provide
>> your actual (non-working) command line and its complete, uncut console
>> output.
>
> One thing missing is some directed speculation even before the cmd line is sent; it's a valuable part of troubleshooting and helps those asking to learn.
>
>
> To the OP-
> You might try providing dummy video to go with the audio (I know some software doesn't deal well when there is no video stream).
>
> I think all you need to add something like
>
>  -i color=s=$outFormat:c=black:r=$videoRate
>
> but I haven't tried it.
>
> z!
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Generate MPEG Transport stream from audio files only

Carl Zwanzig
On 3/9/2018 7:05 AM, Pierre Pasquet wrote:
> I have tried your solution and here’s what I get : Unable to find a suitable output format for 'color=s=:c=black:r='
> color=s=:c=black:r=: Invalid argument

You can't just drop in "color=s=$outFormat:c=black:r=$videoRate" and expect
it to work unless variables outFormat and videoRate are defined. Take a look
at the color filter docs for the relevant values. (For me, both outFormat
and videoRate are usually "ntsc").

z!
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Generate MPEG Transport stream from audio files only

Pierre Pasquet
I’ll have a look. What I don’t understand is that for VOD playback, I use mediafilesegmenter -f /Library/WebServer/Documents/live test.aac  and it works perfectly fine ! The playlist is created with the relevant .aac segment files.

Why can’t I just do the same for a stream segmenter? Doesn’t FFMpeg provide a way to create a MPEG-2 transport stream with Audio only?

Thanks,

> On 9 Mar 2018, at 17:30, Carl Zwanzig <[hidden email]> wrote:
>
> On 3/9/2018 7:05 AM, Pierre Pasquet wrote:
>> I have tried your solution and here’s what I get : Unable to find a suitable output format for 'color=s=:c=black:r='
>> color=s=:c=black:r=: Invalid argument
>
> You can't just drop in "color=s=$outFormat:c=black:r=$videoRate" and expect it to work unless variables outFormat and videoRate are defined. Take a look at the color filter docs for the relevant values. (For me, both outFormat and videoRate are usually "ntsc").
>
> z!
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Generate MPEG Transport stream from audio files only

Moritz Barsnick
On Fri, Mar 09, 2018 at 17:34:05 +0000, Pierre Pasquet wrote:
> Why can’t I just do the same for a stream segmenter? Doesn’t FFMpeg provide a way to create a MPEG-2 transport stream with Audio only?

Yes it does. If you launch your audio-only ffmpeg stream (but not your
segmenter), and then separately issue a "receiver" as such:

$ ffmpeg -i udp://127.0.0.1:5555

you will see that you receive an mpegts stream with only AAC audio.
(Alas, when trying, my ffmpeg "receiver" took almost 10 seconds to pick
up the stream.)

Perhaps the segmenter is picky about the TS format, and ffmpeg isn't
complying to its requirements. *shrug*

Moritz
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Generate MPEG Transport stream from audio files only

Pierre Pasquet
I’m confused.
What does $ ffmpeg -i udp://127.0.0.1:5555 <udp://127.0.0.1:5555> actually do?
Is it a substitute to mediastreamsegmenter?

Pierre

> On 9 Mar 2018, at 18:44, Moritz Barsnick <[hidden email]> wrote:
>
> On Fri, Mar 09, 2018 at 17:34:05 +0000, Pierre Pasquet wrote:
>> Why can’t I just do the same for a stream segmenter? Doesn’t FFMpeg provide a way to create a MPEG-2 transport stream with Audio only?
>
> Yes it does. If you launch your audio-only ffmpeg stream (but not your
> segmenter), and then separately issue a "receiver" as such:
>
> $ ffmpeg -i udp://127.0.0.1:5555
>
> you will see that you receive an mpegts stream with only AAC audio.
> (Alas, when trying, my ffmpeg "receiver" took almost 10 seconds to pick
> up the stream.)
>
> Perhaps the segmenter is picky about the TS format, and ffmpeg isn't
> complying to its requirements. *shrug*
>
> Moritz
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Generate MPEG Transport stream from audio files only

Moritz Barsnick
On Fri, Mar 09, 2018 at 18:47:33 +0000, Pierre Pasquet wrote:
> I’m confused.
> What does $ ffmpeg -i udp://127.0.0.1:5555 <udp://127.0.0.1:5555> actually do?
> Is it a substitute to mediastreamsegmenter?

No. It verifies that what the other ffmpeg sent was actually an MPEG-TS
with audio only. To answer the question "Doesn’t FFMpeg provide a way
to create a MPEG-2 transport stream with Audio only?", or to point out
that that isn't the issue. (But your sending ffmpeg already confirmed
that in its logs.)

Does "man mediastreamsegmenter" give you any command line options for
better issue analysis (such as some verbosity level)?

BTW, please try to avoid to-posting.

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

Moritz
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Generate MPEG Transport stream from audio files only

Carl Eugen Hoyos-2
In reply to this post by Carl Zwanzig
2018-03-09 4:51 GMT+01:00 Carl Zwanzig <[hidden email]>:
> On 3/8/2018 8:17 AM, Moritz Barsnick wrote:
>>
>> As Carl Eugen tried to point out: What is missing is that you provide
>> your actual (non-working) command line and its complete, uncut console
>> output.
>
> One thing missing is some directed speculation even before the cmd
> line is sent; it's a valuable part of troubleshooting and helps those
> asking to learn.

Allow me to try to interpret this, please correct me if I misunderstand:
You suggest that we use the limited time for answering user questions
for those questions that are incomplete and not for those that include
all necessary information?
(You agree that time is the limiting factor, no?)

In general (not related to this question): The only thing we (can) request
from users are samples, so trying hard to answer a question before a
sample was provided would be a large disadvantage for us;-(

Finally: It would have been difficult to guess that the issue here is
apparently unrelated to FFmpeg...

Carl Eugen
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".