Transport Stream video encoded by VLC doesn't play on iPhone

macOS specific usage questions
jaimed
Blank Cone
Blank Cone
Posts: 21
Joined: 16 Jun 2009 08:54

Transport Stream video encoded by VLC doesn't play on iPhone

Postby jaimed » 17 Jun 2009 10:54

Hello

I want to encode a video to the MPEG2 Transport Stream format (H264 + AAC) which is supported by the iPhone. VLC is able to convert the video to the specific format, but when I try to watch it in my iPhone, it only plays audio. I suposse this is a problem with the video codec, so I tried with different x264 codification parameters but got the same result.

I'm using the last version of VLC, and this is my execution line:

Code: Select all

"/Applications/VLC.app/Contents/MacOS/VLC" -I dummy "/Users/ajln/Desktop/batman.mp4" --sout='#transcode{vcodec=h264{nocabac,level=30},vb=700,scale=1,acodec=mp4a,ab=128,deinterlace,channels=2,bframes=0}:duplicate{dst=std{access=udp,mux=ts,dst=<IP>:8080}}'
Does anybody know the solution? maybe hints?

Thanks!

fkuehne
Developer
Developer
Posts: 7265
Joined: 16 Mar 2004 19:37
VLC version: 0.4.6 - present
Operating System: Darwin
Location: Germany
Contact:

Re: Transport Stream video encoded by VLC doesn't play on iPhone

Postby fkuehne » 17 Jun 2009 12:06

MPEG2 TS isn't supported by the iPhone. It neither is by QuickTime Player nor iTunes.

The iPhone supports the following:
Video formats supported: H.264 video, up to 1.5 Mbps, 640 by 480 pixels, 30 frames per second, Low-Complexity version of the H.264 Baseline Profile with AAC-LC audio up to 160 Kbps, 48kHz, stereo audio in .m4v, .mp4, and .mov file formats; H.264 video, up to 2.5 Mbps, 640 by 480 pixels, 30 frames per second, Baseline Profile up to Level 3.0 with AAC-LC audio up to 160 Kbps, 48kHz, stereo audio in .m4v, .mp4, and .mov file formats; MPEG-4 video, up to 2.5 Mbps, 640 by 480 pixels, 30 frames per second, Simple Profile with AAC-LC audio up to 160 Kbps, 48kHz, stereo audio in .m4v, .mp4, and .mov file formats
Therefore, I strongly recommend to use a MP4 container for your video. Additionally, make sure that your video isn't larger than 640*480px.
VideoLAN
Felix Paul Kühne
Medic. VLC developer for appleOS since before you were born.
Blog: https://www.feepk.net

jaimed
Blank Cone
Blank Cone
Posts: 21
Joined: 16 Jun 2009 08:54

Re: Transport Stream video encoded by VLC doesn't play on iPhone

Postby jaimed » 17 Jun 2009 12:39

Hello Fkuehne

I didn't know iPhone can't play TS format, but am sure that the new OS 3.0 does, because I've achieved it, using another software to do the video encoding (Windows).

I wish I could use mp4, but in the middle I have to use an Apple software called Media Stream Segmenter that only accepts TS as input.

ajmas
Big Cone-huna
Big Cone-huna
Posts: 935
Joined: 04 Feb 2006 07:33
VLC version: 3.0.x
Operating System: MacOS X
Location: Montreal, Canada

Re: Transport Stream video encoded by VLC doesn't play on iPhone

Postby ajmas » 18 Jun 2009 21:14

I am not aware of the details for the iPhone, but the specifications for the iPhone 3GS indicate:
Video formats supported: H.264 video, up to 1.5 Mbps, 640 by 480 pixels, 30 frames per second, Low-Complexity version of the H.264 Baseline Profile with AAC-LC audio up to 160 Kbps, 48kHz, stereo audio in .m4v, .mp4, and .mov file formats; H.264 video, up to 2.5 Mbps, 640 by 480 pixels, 30 frames per second, Baseline Profile up to Level 3.0 with AAC-LC audio up to 160 Kbps, 48kHz, stereo audio in .m4v, .mp4, and .mov file formats; MPEG-4 video, up to 2.5 Mbps, 640 by 480 pixels, 30 frames per second, Simple Profile with AAC-LC audio up to 160 Kbps, 48kHz, stereo audio in .m4v, .mp4, and .mov file formats
The specifications for the iPhone 3G indicate the same thing.

Edit: Sorry Fkuehne, I hadn't seen you had posted the exact same quote.
Providing logs, messages, configuration info (VLC, OS, Hardware) and a clear explanation of the issue always helps the problem solvers help you, even if they don't end up solving the issue. Just think what you would need if you were solving someone else's problem. Additional: Always looking for eager and capable MacOS X developers to join the VLC team - for more information see here.

jaimed
Blank Cone
Blank Cone
Posts: 21
Joined: 16 Jun 2009 08:54

Re: Transport Stream video encoded by VLC doesn't play on iPhone

Postby jaimed » 19 Jun 2009 08:55

I can play .ts videos encoded with another software, so iPhone supports it

ajmas
Big Cone-huna
Big Cone-huna
Posts: 935
Joined: 04 Feb 2006 07:33
VLC version: 3.0.x
Operating System: MacOS X
Location: Montreal, Canada

Re: Transport Stream video encoded by VLC doesn't play on iPhone

Postby ajmas » 19 Jun 2009 13:05

What is the name of the 'other' software. It will be interesting to see why one works and the other doesn't. Are you selecting any specific settings in the other software, such as dimensions, frame rate, codec etc.
Providing logs, messages, configuration info (VLC, OS, Hardware) and a clear explanation of the issue always helps the problem solvers help you, even if they don't end up solving the issue. Just think what you would need if you were solving someone else's problem. Additional: Always looking for eager and capable MacOS X developers to join the VLC team - for more information see here.

jaimed
Blank Cone
Blank Cone
Posts: 21
Joined: 16 Jun 2009 08:54

Re: Transport Stream video encoded by VLC doesn't play on iPhone

Postby jaimed » 19 Jun 2009 13:13

the other software is SUPER for windows. These are its settings:

video: H264/AVC - profile: Baseline (Cabac off) Level 3
audio: AAC LC - 48K 2ch 128kbps

resolution: 640x480
aspect: 4:3
frames/sec: 30
bitrate: 2400 kbps


I think the problem is the video profile... if I could know the ffmpeg command line used by SUPER...

Thanks

The DJ
Cone Master
Cone Master
Posts: 5987
Joined: 22 Nov 2003 21:52
VLC version: git
Operating System: Mac OS X
Location: Enschede, Holland
Contact:

Re: Transport Stream video encoded by VLC doesn't play on iPhone

Postby The DJ » 19 Jun 2009 15:58

I can play .ts videos encoded with another software, so iPhone supports it
. And then you list a windows player that has nothing to do with the iPhone. You also seem to be very confused about what a fileformat is, and what codecs are. You should read up on it.
Don't use PMs for support questions.

VulpineLogic
New Cone
New Cone
Posts: 1
Joined: 19 Jun 2009 20:46

Re: Transport Stream video encoded by VLC doesn't play on iPhone

Postby VulpineLogic » 19 Jun 2009 21:11

And then you list a windows player that has nothing to do with the iPhone. You also seem to be very confused about what a fileformat is, and what codecs are. You should read up on it.
Maybe you should do some reading instead.

SUPER is just a front-end for ffmpeg, and ffmpeg can operate in a mode that produces an MPEG-2 TS over udp, which in turn can be picked up by Apple's mediastreamsegmenter for the final step in delivering the stream to the iPhone.

When using VLC to send MPEG-2 TS to the mediastreamsegmenter, weird behavior ensues.

Using the most recent nightly build (grabbed about an hour ago), the mediastreamsegmenter continually spits out "no start access unit".

Anyway, I'm trying to accomplish a similar goal as described in the original post, but I need to stream from a MacBook's built in iSight camera and can't seem to get ffmpeg to read from the camera. "qtcapture://" does the trick in VLC, but then VLC's MPEG-2 TS output can't seem to be read correctly by the mediastreamsegmenter.

I'm now looking at somehow running VLC through ffmpeg in order to get proper behavior from the mediastreamingsegmenter. :roll:

The DJ
Cone Master
Cone Master
Posts: 5987
Joined: 22 Nov 2003 21:52
VLC version: git
Operating System: Mac OS X
Location: Enschede, Holland
Contact:

Re: Transport Stream video encoded by VLC doesn't play on iPhone

Postby The DJ » 20 Jun 2009 12:30

Where did you mention "mediastreamsegmenter" before ? How am I supposed to know people use a "mediastreamsegmenter" ?
Don't use PMs for support questions.

jaimed
Blank Cone
Blank Cone
Posts: 21
Joined: 16 Jun 2009 08:54

Re: Transport Stream video encoded by VLC doesn't play on iPhone

Postby jaimed » 22 Jun 2009 09:54

@DJ: the use of the "mediastreamsegmenter" is not relevant in this topic; it's only a program that cuts the video/stream in segments without doing any conversion.

Like vulpinelogic wrote, SUPER is a GUI for ffmpeg, so if SUPER works (with the default settings), VLC should with the proper settings; which I don't know what they are
When using VLC to send MPEG-2 TS to the mediastreamsegmenter, weird behavior ensues.

Using the most recent nightly build (grabbed about an hour ago), the mediastreamsegmenter continually spits out "no start access unit".
When you have a proper TS it works great. Try this: viewtopic.php?f=4&t=60684&p=204224#p203533

The DJ
Cone Master
Cone Master
Posts: 5987
Joined: 22 Nov 2003 21:52
VLC version: git
Operating System: Mac OS X
Location: Enschede, Holland
Contact:

Re: Transport Stream video encoded by VLC doesn't play on iPhone

Postby The DJ » 22 Jun 2009 13:45

Oh but it very much IS important, because it is brand new apple technology for iPhone OS 3.0 and Snow Leopard, that I wasn't even aware of.

What you are trying to do is called HTTP Live streaming. If you had said that, then I would have understood a lot sooner. I'm not sure why the iphone doesn't understand our h264 video in MPEG-TS. To be honest, we have no test environment for iPhone atm, and Apple's debug is not helpful it seems. So you are on your own :( There are several bugreports on issues with mp4 h264 support, but I'm not aware of any MPEG-TS issues at this time.
Don't use PMs for support questions.

jaimed
Blank Cone
Blank Cone
Posts: 21
Joined: 16 Jun 2009 08:54

Re: Transport Stream video encoded by VLC doesn't play on iPhone

Postby jaimed » 23 Jun 2009 10:51

At the moment I can only think of VLC to do this task prior to the segmentation. If SUPER and VLC both use ffmpeg+x264 for the encoding then we'll find the needed settings for sure.

Only a question... in the settings for x264 on VLC preferences... Can I set all the parameters available in command line?

The DJ
Cone Master
Cone Master
Posts: 5987
Joined: 22 Nov 2003 21:52
VLC version: git
Operating System: Mac OS X
Location: Enschede, Holland
Contact:

Re: Transport Stream video encoded by VLC doesn't play on iPhone

Postby The DJ » 23 Jun 2009 14:24

It can also be the framing that is a problem. And yes all option in the VLC preferences are available from the commandline.

./VLC --full-help for a full listing of all console options and their usage.
Don't use PMs for support questions.

jaimed
Blank Cone
Blank Cone
Posts: 21
Joined: 16 Jun 2009 08:54

Re: Transport Stream video encoded by VLC doesn't play on iPhone

Postby jaimed » 23 Jun 2009 15:25

And yes all option in the VLC preferences are available from the commandline.
and all the options in the command line are adjustable in the VLC preferences? (sorry, I got the wrong question before)

thanks for your responses

The DJ
Cone Master
Cone Master
Posts: 5987
Joined: 22 Nov 2003 21:52
VLC version: git
Operating System: Mac OS X
Location: Enschede, Holland
Contact:

Re: Transport Stream video encoded by VLC doesn't play on iPhone

Postby The DJ » 24 Jun 2009 16:49

and all the options in the command line are adjustable in the VLC preferences?
Correct.
Don't use PMs for support questions.

jaimed
Blank Cone
Blank Cone
Posts: 21
Joined: 16 Jun 2009 08:54

Re: Transport Stream video encoded by VLC doesn't play on iPhone

Postby jaimed » 02 Jul 2009 12:22

hello

I go on with this. I have another question related to the conversion. I have a "well encoded" video, send it through a rtsp stream in a 3GP container, open the stream with VLC and try to emit it using UDP; but don't use transcoding (i.e. I only change the container to MPEG TS). Will this affect to the video and audio encoding or leave them intact?

thanks

The DJ
Cone Master
Cone Master
Posts: 5987
Joined: 22 Nov 2003 21:52
VLC version: git
Operating System: Mac OS X
Location: Enschede, Holland
Contact:

Re: Transport Stream video encoded by VLC doesn't play on iPhone

Postby The DJ » 02 Jul 2009 13:53

Depends. VLC won't support re-packing h264 video retrieved from RTSP atm. The reason for this is that using RTSP, you loose the DTS timestamps, and thus a piece of software is required (packetizer) to "recreate" this value. Unfortunately for h264 this is very complex and the packetizer is not finished yet.
Don't use PMs for support questions.

jaimed
Blank Cone
Blank Cone
Posts: 21
Joined: 16 Jun 2009 08:54

Re: Transport Stream video encoded by VLC doesn't play on iPhone

Postby jaimed » 03 Jul 2009 13:25

Hi DJ

I have a ffmpeg command that results in a mpeg ts playable in the iPhone!!! Here it is...

Code: Select all

ffmpeg -i input.mp4 -f mpegts -acodec libmp3lame -ar 48000 -ab 128k -s 320×240 -vcodec libx264 -b 384k -flags +loop -cmp +chroma -subq 5 -trellis 1 -refs 1 -coder 0 -me_range 16 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -bt 200k -maxrate 384k -bufsize 384k -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -level 30 -aspect 320:240 -g 30 -async 2 output.ts
( from http://www.ioncannon.net/programming/45 ... segmenter/ )

If we translate this into a vlc command then we'll have http live streaming support on vlc :) If you know an approximated answer I could test it myself and give feedback

cheers

jaimed
Blank Cone
Blank Cone
Posts: 21
Joined: 16 Jun 2009 08:54

Re: Transport Stream video encoded by VLC doesn't play on iPhone

Postby jaimed » 06 Jul 2009 13:34

hello again,

I'm trying to replicate the command without success, but think I'm near...

Code: Select all

"/Applications/VLC.app/Contents/MacOS/VLC" -vvv -I dummy "/Users/ajln/Desktop/batman.mp4" --sout='#transcode{vcodec=h264,venc=x264{no-cabac,level=3.0,subme=5,trellis=1,merange=16,min-keyint=25,scenecut=40,ipratio=0.71,ratetol=20k,vbv-maxrate=96k,vbv-bufsize=96k,,qcomp=0.6,qpmin=10,qpmax=51,qpstep=4,keyint=30,ref=1,deblock=0:0},scale=1,acodec=mp4a,ab=128,samplerate=48000,channels=2,width=320,height=240}:duplicate{dst=std{access=udp,mux=ts,dst=127.0.0.1:1234}}'
apparently the x264 options are the same, but:

- no rc_eq option found
- no param equivalent to "-bt"

What should I do to use ffmpeg instead of x264 as venc?

regards

whyz
New Cone
New Cone
Posts: 1
Joined: 06 Jul 2009 13:56

Re: Transport Stream video encoded by VLC doesn't play on iPhone

Postby whyz » 06 Jul 2009 23:08

Hi,

If you're making any progress, I would like to hear about it. :)

wooo
Blank Cone
Blank Cone
Posts: 11
Joined: 04 Aug 2008 18:14

Re: Transport Stream video encoded by VLC doesn't play on iPhone

Postby wooo » 07 Jul 2009 06:55

Hi Folks,
I've got a command that works for "Many" videos (pre-recorded, haven't done any live transcoding). This is using a recent VLC nightly build, btw.

/Applications/VLC.app/Contents/MacOS/VLC -vvv -I dummy "/Users/[..snip..]/Movies/History of House.mp4" --sout="#transcode{width=160,canvas-height=120,vcodec=h264,samplerate=44100,vb=64,fps=15,acodec=mp3,ab=64}:standard{access=file,mux=ts,dst='-'}" | segmenter .... etc.

So here's what I've found...
I'm using the open source "segmenter" based on ffmpeg (same one that this is based on: http://www.ioncannon.net/programming/45 ... segmenter/ )

I've got this working fine actually, except that the last segment appears to be corrupted so the video doesn't finish playing. This is something that might be able to be fixed by the segmenter itself, but is probably due to a difference in the mpegts stream from VLC vs. ffmpeg, because...

this command (using ffmpeg on the same video) DOES work, all the way to the end :)

/opt/local/bin/ffmpeg -i "/Users/[..snip..]/Movies/History of House.mp4" -acodec libmp3lame -vcodec libx264 -f mpegts -ab 64kb -b 128kb -s 320x192 - | segmenter ...

Btw, I've used identical width/height for both and there is no difference, I just had this one ready to paste...

So the creator of the ffmpeg dependent segmenter had a patch to the mpegts muxer that was accepted into ffmpeg to fix a bug that caused it not to work right. I know vlc uses ffmpeg, but I'm not sure if it's always the latest from head and I'm not sure if the mpegts muxer in vlc is actually ffmpeg's or VLC's own. I'd really like to get it working on ALL videos that VLC can play, and I'd also like to figure out what's going wrong with the last segment not converting right.

loretta80
New Cone
New Cone
Posts: 2
Joined: 07 Jul 2009 07:00

Re: Transport Stream video encoded by VLC doesn't play on iPhone

Postby loretta80 » 07 Jul 2009 07:08

@ Wooo
You build a file (:standard{access=file,mux=ts,dst='-'}") but this thread is about to stream with live transcoding i think.

And thats my problem too. I tried the command line from above and thats the error message:

access_output_udp error: failed to create raw UDP socket
stream_out_standard error: no suitable sout access module for `udp/ts://0.0.0.0:27010'
stream_out_duplicate error: no destination given
stream_out_transcode error: cannot create chain
main error: stream chain failed for `transcode{vcodec=h264,venc=x264{no-cabac,level=3.0,subme=5,trellis=1,merange=16,min-keyint=25,scenecut=40,ipratio=0.71,ratetol=20k,vbv-maxrate=96k,vbv-bufsize=96k,,qcomp=0.6,qpmin=10,qpmax=51,qpstep=4,keyint=30,ref=1,deblock=0:0},scale=1,acodec=mp4a,ab=128,samplerate=48000,channels=2,width=320,height=240}:duplicate{dst=std{access=udp,mux=ts,dst=0.0.0.0:27010}}'
main error: cannot start stream output instance, aborting

So i think the container format and the udp stream doesn't work together, right? So i think the first step must be which container,videocodec and audiocodec combination is allowed to stream via http or udp.
I think the nicest way would be Video on demand, but i dont have expirience with that.

wooo
Blank Cone
Blank Cone
Posts: 11
Joined: 04 Aug 2008 18:14

Re: Transport Stream video encoded by VLC doesn't play on iPhone

Postby wooo » 07 Jul 2009 07:25

@loretta80
Sure, but the only difference is I'm using the open source ffmpeg based segmenter which supports stdin and the other person was using the apple provided segmenter, which is closed source, protected by a NDA, and only runs on an intel mac (have I said too much ;).

What I'm saying is that you can accomplish the same goal: live streaming to iPhone using the same command I gave above, but changing the input source from a file to be "qtcapture://" I'm doing a live transcode to "ts" stream to segmenter. The only difference was the source, and the segmenter, and the errors I've mentioned.

loretta80
New Cone
New Cone
Posts: 2
Joined: 07 Jul 2009 07:00

Re: Transport Stream video encoded by VLC doesn't play on iPhone

Postby loretta80 » 07 Jul 2009 07:48

Now i just tried this
:sout=#transcode{vcodec=h264,vb=800,scale=0.5,acodec=mp4a,ab=128,channels=2}:duplicate{dst=display,dst=std{access=udp,mux=ts,dst=192.168.1.127:27010}}

an VLC 0.9.9.0 hangs up with an error in libx264_plugin.dll

tried to stream a avi file with this values:

Format : AVI
Format/Info : Audio Video Interleave
File size : 346 MiB
Duration : 41min
Overall bit rate : 1 168 Kbps
Writing application : Nandub v1.0rc2
Writing library : Nandub build 1852/release

Video
ID : 0
Format : MPEG-4 Visual
Format profile : Streaming Video@L1
Format settings, BVOP : Ja
Format settings, QPel : Nein
Format settings, GMC : Keine warppoints
Format settings, Matrix : Default (MPEG)
Muxing mode : Packed bitstream
Codec ID : XVID
Codec ID/Hint : XviD
Duration : 41min
Bit rate : 977 Kbps
Width : 640 Pixel
Height : 352 Pixel
Display aspect ratio : 16/9
Frame rate : 25,000 FPS
Original frame rate : 23,976 FPS
Resolution : 24 bits
Colorimetry : 4:2:0
Scan type : progressiv
Bits/(Pixel*Frame) : 0.173
Stream size : 289 MiB (84%)
Writing library : XviD 1.1.0 (UTC 2005-11-22)

Audio
ID : 1
Format : MPEG Audio
Format version : Version 1
Format profile : Layer 3
Codec ID : 55
Codec ID/Hint : MP3
Duration : 41min
Bit rate mode : variabel
Bit rate : 178 Kbps
Channel(s) : 2 Kanäle
Sampling rate : 48,0 KHz
Resolution : 16 bits
Stream size : 52,7 MiB (15%)
Alignment : Ausgerichtet an Interleaves
Interleave, duration : 24 ms (0,60 Video-Frame)
Interleave, preload duration : 103 ms

Tried some more else with the same error. Is this a bug or is the combination incorrect?


Return to “VLC media player for macOS Troubleshooting”

Who is online

Users browsing this forum: No registered users and 24 guests