Sign up here and you can log into the forum!

ffmpeg transcoding on the wdtv - success and failure

Discussion, features, plugins--everything about zoster's UMSP UPnP Media Server software

ffmpeg transcoding on the wdtv - success and failure   

Postby foxer » Wed Jul 20, 2011 7:46 am

Hello everyone

I know transcoding has been discussed before (http://forum.wdlxtv.com/viewtopic.php?f=53&t=3726) and it's considered not an option on the wdtv, but I would like to give it another go...

My idea is - transcode to something as simple as possible that the wdtv can play. The result doesn't have to be stored anywhere, so it doesn't matter that it will have a high bitrate. So, I planned to transcode some flv that isn't supported (H.263) to raw video or to mpeg1 or some ancient format that doesn't need too much for encoding.

Details for the original file:
Code: Select all
mediainfo nu-merge.flv
General
Complete name                    : nu-merge.flv
Format                           : Flash Video
File size                        : 82.4 MiB
Duration                         : 18mn 58s
Overall bit rate                 : 607 Kbps
Tagging application              : Yet Another Metadata Injector for FLV - Version 1.4

Video
Format                           : H.263
Codec ID                         : 2
Codec ID/Hint                    : Sorenson
Duration                         : 18mn 58s
Bit rate                         : 538 Kbps
Width                            : 320 pixels
Height                           : 240 pixels
Display aspect ratio             : 4:3
Frame rate mode                  : Constant
Frame rate                       : 24.000 fps
Bit depth                        : 8 bits
Compression mode                 : Lossy
Bits/(Pixel*Frame)               : 0.292
Stream size                      : 75.1 MiB (91%)

Audio
Format                           : MPEG Audio
Format version                   : Version 2
Format profile                   : Layer 3
Mode                             : Joint stereo
Mode extension                   : MS Stereo
Codec ID                         : 2
Codec ID/Hint                    : MP3
Duration                         : 18mn 58s
Bit rate mode                    : Variable
Bit rate                         : 47.1 Kbps
Channel(s)                       : 2 channels
Sampling rate                    : 22.05 KHz
Compression mode                 : Lossy
Stream size                      : 7.00 MiB (8%)


Here are my results:
1. Convert to raw video (uncompressed YUV):
Code: Select all
time ffmpeg -i nu-merge.flv -acodec copy  -vcodec rawvideo nu-merge-raw.avi

* managed to get 27fps, at a bitrate of 22Mbps :) This proves that the wdtv can decode some things in software, in real time (I didn't convert the whole file, though)
* unfortunately, is not playable on the wdtv (unsupported format)
Code: Select all
General
Complete name                    : nu-merge-raw.avi
Format                           : AVI
Format/Info                      : Audio Video Interleave
File size                        : 183 MiB
Duration                         : 1mn 9s
Overall bit rate                 : 22.2 Mbps
Writing application              : Lavf52.73.0

Video
ID                               : 0
Format                           : YUV
Codec ID                         : I420
Codec ID/Info                    : 8 bit Y plane followed by 8 bit 2x2 subsampled U and V planes.
Duration                         : 1mn 9s
Bit rate                         : 22.1 Mbps
Width                            : 320 pixels
Height                           : 240 pixels
Display aspect ratio             : 4:3
Frame rate                       : 24.000 fps
Compression mode                 : Lossless
Bits/(Pixel*Frame)               : 12.000
Stream size                      : 182 MiB (100%)

Audio
ID                               : 1
Format                           : MPEG Audio
Format version                   : Version 2
Format profile                   : Layer 3
Mode                             : Joint stereo
Mode extension                   : MS Stereo
Codec ID                         : 55
Codec ID/Hint                    : MP3
Duration                         : 1mn 9s
Bit rate mode                    : Variable
Bit rate                         : 8 000 bps
Channel(s)                       : 2 channels
Sampling rate                    : 22.05 KHz
Compression mode                 : Lossy
Stream size                      : 398 KiB (0%)
Alignment                        : Aligned on interleaves
Interleave, duration             : 26 ms (0.63 video frame)
Interleave, preload duration     : 26 ms



2. Convert to mpeg1 - it's a pretty old standard, so it might be easily encoded. I played with some settings for a while, and the best speed I could get was 19-20fps. The bitrate is 100kbps and the quality looks awful (even for low resolution video), but it is watchable...
Code: Select all
time ffmpeg -i nu-merge.flv -acodec copy -b 100k -vcodec mpeg1video nu-merge-mpeg1video.mpg


* managed to get 21fps, at a bitrate of 160kbps. At this rate, there are constant macro-blocks visible onscreen.

Code: Select all
General
Complete name                    : nu-merge-mpeg1video.mpg
Format                           : MPEG-PS
File size                        : 2.03 MiB
Duration                         : 1mn 38s
Overall bit rate                 : 173 Kbps

Video
ID                               : 224 (0xE0)
Format                           : MPEG Video
Format version                   : Version 1
Format settings, BVOP            : No
Format settings, Matrix          : Default
Duration                         : 1mn 38s
Bit rate mode                    : Variable
Bit rate                         : 162 Kbps
Width                            : 320 pixels
Height                           : 240 pixels
Display aspect ratio             : 4:3
Frame rate                       : 24.000 fps
Color space                      : YUV
Bit depth                        : 8 bits
Scan type                        : Progressive
Compression mode                 : Lossy
Bits/(Pixel*Frame)               : 0.088
Stream size                      : 1.90 MiB (93%)

Audio
ID                               : 192 (0xC0)
Format                           : MPEG Audio
Format version                   : Version 2
Format profile                   : Layer 3
Mode                             : Joint stereo
Mode extension                   : MS Stereo
Duration                         : 1mn 38s
Bit rate mode                    : Constant
Bit rate                         : 8 000 bps
Channel(s)                       : 2 channels
Sampling rate                    : 22.05 KHz
Compression mode                 : Lossy
Stream size                      : 96.2 KiB (5%)



3. Mpeg4 - why not?
Code: Select all
time ffmpeg -i nu-merge.flv -acodec copy  -vcodec mpeg4 nu-merge-mpeg4.avi

* similar performance to mpeg1 - 16fps at 200kbps
Code: Select all
General
Complete name                    : nu-merge-mpeg4.avi
Format                           : AVI
Format/Info                      : Audio Video Interleave
File size                        : 2.43 MiB
Duration                         : 1mn 12s
Overall bit rate                 : 283 Kbps
Writing application              : Lavf52.73.0

Video
ID                               : 0
Format                           : MPEG-4 Visual
Format profile                   : Simple@L1
Format settings, BVOP            : No
Format settings, QPel            : No
Format settings, GMC             : No warppoints
Format settings, Matrix          : Default (H.263)
Codec ID                         : FMP4
Duration                         : 1mn 12s
Bit rate                         : 222 Kbps
Width                            : 320 pixels
Height                           : 240 pixels
Display aspect ratio             : 4:3
Frame rate                       : 24.000 fps
Color space                      : YUV
Chroma subsampling               : 4:2:0
Bit depth                        : 8 bits
Scan type                        : Progressive
Compression mode                 : Lossy
Bits/(Pixel*Frame)               : 0.121
Stream size                      : 1.91 MiB (79%)
Writing library                  : Lavc52.83.0

Audio
ID                               : 1
Format                           : MPEG Audio
Format version                   : Version 2
Format profile                   : Layer 3
Mode                             : Joint stereo
Mode extension                   : MS Stereo
Codec ID                         : 55
Codec ID/Hint                    : MP3
Duration                         : 1mn 12s
Bit rate mode                    : Variable
Bit rate                         : 8 000 bps
Channel(s)                       : 2 channels
Sampling rate                    : 22.05 KHz
Compression mode                 : Lossy
Stream size                      : 417 KiB (17%)
Alignment                        : Aligned on interleaves
Interleave, duration             : 26 ms (0.63 video frame)
Interleave, preload duration     : 26 ms



4. WMV
Code: Select all
time ffmpeg -i nu-merge.flv -acodec copy  -vcodec wmv2 nu-merge-wmv8.avi

* got about 15-17 fps
* will not play back on the wdtv, because WMV 8 is not supported (9 is, but the built-in ffmpeg can't write it)
Code: Select all
General
Complete name                    : nu-merge-wmv8.avi
Format                           : AVI
Format/Info                      : Audio Video Interleave
File size                        : 2.09 MiB
Duration                         : 1mn 0s
Overall bit rate                 : 288 Kbps
Writing application              : Lavf52.73.0

Video
ID                               : 0
Format                           : WMV2
Codec ID                         : WMV2
Codec ID/Info                    : Windows Media Video 8
Duration                         : 1mn 0s
Bit rate                         : 227 Kbps
Width                            : 320 pixels
Height                           : 240 pixels
Display aspect ratio             : 4:3
Frame rate                       : 24.000 fps
Bits/(Pixel*Frame)               : 0.123
Stream size                      : 1.65 MiB (79%)

Audio
ID                               : 1
Format                           : MPEG Audio
Format version                   : Version 2
Format profile                   : Layer 3
Mode                             : Joint stereo
Mode extension                   : MS Stereo
Codec ID                         : 55
Codec ID/Hint                    : MP3
Duration                         : 1mn 0s
Bit rate mode                    : Variable
Bit rate                         : 8 000 bps
Channel(s)                       : 2 channels
Sampling rate                    : 22.05 KHz
Compression mode                 : Lossy
Stream size                      : 351 KiB (16%)
Alignment                        : Aligned on interleaves
Interleave, duration             : 26 ms (0.63 video frame)
Interleave, preload duration     : 26 ms


5. MJPEG
Code: Select all
time ffmpeg -i nu-merge.flv -acodec copy  -vcodec mjpeg nu-merge-mjpeg.avi

* got 16-17 fps
* video is playable, but with a lower quality than even mpeg1 (there are compression blocks all over the screen)
Code: Select all
General
Complete name                    : nu-merge-mjpeg.avi
Format                           : AVI
Format/Info                      : Audio Video Interleave
File size                        : 6.21 MiB
Duration                         : 1mn 4s
Overall bit rate                 : 806 Kbps
Writing application              : Lavf52.73.0

Video
ID                               : 0
Format                           : JPEG
Codec ID                         : MJPG
Duration                         : 1mn 4s
Bit rate                         : 746 Kbps
Width                            : 320 pixels
Height                           : 240 pixels
Display aspect ratio             : 4:3
Frame rate                       : 24.000 fps
Color space                      : YUV
Chroma subsampling               : 4:4:4
Bit depth                        : 8 bits
Compression mode                 : Lossy
Bits/(Pixel*Frame)               : 0.404
Stream size                      : 5.75 MiB (92%)

Audio
ID                               : 1
Format                           : MPEG Audio
Format version                   : Version 2
Format profile                   : Layer 3
Mode                             : Joint stereo
Mode extension                   : MS Stereo
Codec ID                         : 55
Codec ID/Hint                    : MP3
Duration                         : 1mn 4s
Bit rate mode                    : Variable
Bit rate                         : 8 000 bps
Channel(s)                       : 2 channels
Sampling rate                    : 22.05 KHz
Compression mode                 : Lossy
Stream size                      : 373 KiB (6%)
Alignment                        : Aligned on interleaves
Interleave, duration             : 26 ms (0.63 video frame)
Interleave, preload duration     : 26 ms


Now, the purpose of this discussion is to brainstorm and try to figure out some combination/some parameters that would allow the wdtv to do some transcoding in a reliable way... When I started this I had high hopes on uncompressed video, but sadly the wdtv does not support it (and since it's uncompressed, I am sure it could easily be supported - but this is something WD has to fix).

I'd like to hear your suggestions on this and what could be done (except running an external proxy) to improve the performance of the transcoding process?

Regards,
foxer
foxer
WDTVer
 
Posts: 48
Joined: Wed Nov 24, 2010 9:45 am

Re: ffmpeg transcoding on the wdtv - success and failure   

Postby shunte » Wed Jul 20, 2011 1:34 pm

work is work

i don't see the connection between an older codec and less work, normally newer is more efficient at least it is in the technological world I frequent, not counting the resurgence of mainframe big-iron technologies and timeshare - shhhh the cloud is all new technologies and techniques we're not just re-inventing the wheel again, or is it again... again ;) oh yeah and anything written in Java ;)

I spent a good month working on transcoding and ended up with the external proxy solution where quality above all could be attained, the WD just doesn't appear to have the horsepower to get the job done on a single shot

an interesting exercise but i think its prolly a done deal
If you like the work I do please feel free to make a donation to the Red Cross
User avatar
shunte
Developer
 
Posts: 420
Joined: Sun Sep 19, 2010 1:43 am
Location: Cambridge, MA U. S. and A.

Re: ffmpeg transcoding on the wdtv - success and failure   

Postby foxer » Thu Jul 21, 2011 8:07 am

Hello shunte,

Thanks for your reply.

The purpose of video codecs is to compress a raw video feed into something that looks about the same in terms of quality, but doesn't take up as much space as raw video. I assumed that by going with an older codec, it would have to work less to compress the video than when using a newer, more advanced codec. For example, I had my hopes up for mpeg1 - which is actually jpeg + storing differences between frames or even MJPEG (which has just spatial compression), but yes, the experiments showed that the transcoding isn't fast enough :(

I may try to reduce the output framerate to 15 fps (bad, but still watchable), maybe that would provide a constant stream - but I expect major sound synchronization issues :)

If only the firmware would support raw YUV video, all the problems could be solved....
I guess there's very little hope for WD to add this to their firmware (I guess the sigma chip does not support raw video to begin with...).

The real sad thing is that if Google pushes their WebM/VP8/VP9 codec and it becomes mainstream, well be left with unplayable content.

.... But now I'm ranting. :)
Anyone know how to overclock the cpu? :)
foxer
WDTVer
 
Posts: 48
Joined: Wed Nov 24, 2010 9:45 am

Re: ffmpeg transcoding on the wdtv - success and failure   

Postby b-rad.cc » Thu Jul 21, 2011 9:26 am

Have you ever felt the heatsink under idle load? Are you trying to start a fire? :lol:
PM's are for private matters only, please post public matters on the forum to help others who might have the same issue.
:mrgreen:
User avatar
b-rad.cc
WDLXTV Team
 
Posts: 3003
Joined: Sat Apr 03, 2010 9:35 am
Location: New York

Re: ffmpeg transcoding on the wdtv - success and failure   

Postby blachanc » Thu Jul 21, 2011 11:49 am

Even without starting a fire,

Overclocking could greatly reduce the life expectancy of the chip/Box (MTBF:Mean time before failure) .
We are not talking here about overclocking a device that uses an active cooling system,
but something using just an heat sink.

I saw experiments turn bad when overclocking graphic card using passive heat sink.
The goal was to be able to display higher screen resolution, in medical application.

Burn-in test killed all the protos....

But,
your experiment sounds interesting, as long as you do it safely :-)

Ben
blachanc
Patron
 
Posts: 238
Joined: Tue Feb 22, 2011 7:10 am
Location: Montreal,QC, Canada (french)

Re: ffmpeg transcoding on the wdtv - success and failure   

Postby foxer » Thu Jul 21, 2011 10:51 pm

I was kidding about overclocking - I know it's asking for trouble :)

I'll keep trying to experiment with transcoding - maybe I can stumble upon some settings that will make it a workable solution - or at least we'll know what is the best we can expect from transcoding...
foxer
WDTVer
 
Posts: 48
Joined: Wed Nov 24, 2010 9:45 am

Re: ffmpeg transcoding on the wdtv - success and failure   

Postby DJArty » Thu Jul 21, 2011 10:58 pm

foxer Can you provide link to the source flv?
Why did you decide that you need to transcode it?
I have solution for transcode some flv with mp3 sound on the fly...
It's because flv play only AAC sound into it. (WD support confirm this but do nothing).
Just "repack" video and sound track from flv container to another container type without serious WD CPU usage.
WD TV Live (1.02.21-WDLXTV-0.4.7.3);
Please Donate PayPal to email: djartyua ( a t ) gmail (d o t) com
WebMoney: WMZ114867333413
User avatar
DJArty
Developer
 
Posts: 547
Joined: Wed Jul 21, 2010 2:30 am
Location: Ukraine

Re: ffmpeg transcoding on the wdtv - success and failure   

Postby foxer » Fri Jul 22, 2011 12:28 am

Thank you DJArty for your suggestion, however the source codec (Sorenson H.263) is not supported by the wdtv (as stated in teh manual) independent of the container and I need to convert it to something else.

I agree that it would be possible to change containers on the fly and just copy the audio and video streams, but it still wouldn't work for the content I try to show.
I can't provide a link (NSFW), but the videos come from this plugin: http://forum.wdlxtv.com/viewtopic.php?f=53&t=4766

Some content is playable, some not. The differences are in the video codecs used.

So, sadly, there is no easy way out for me.
foxer
WDTVer
 
Posts: 48
Joined: Wed Nov 24, 2010 9:45 am

Re: ffmpeg transcoding on the wdtv - success and failure   

Postby foxer » Fri Jul 29, 2011 3:43 am

I've given the framerate idea a try - I've tried to encode video with a lower framerate in hopes it would reduce the load on the wdtv. In a nutshell - it's worse performance than encoding with the original framerate...


Here are my findings:

1. mpeg1 @ 15fps (with low quality settings):
Code: Select all
time ffmpeg -i nu-merge.flv -acodec copy -b 100k -r 15 -vcodec mpeg1video nu-merge-mpeg1video-15fps.mpg

* mpeg 1 does not support 15fps, so no conversion possible:
Code: Select all
[mpeg1video @ 0x1018580] MPEG1/2 does not support 15/1 fps


2. mpeg4 @ 15 fps (with low quality settings):
Code: Select all
time ffmpeg -i nu-merge.flv -acodec copy -b 100k -r 15 -vcodec mpeg4 nu-merge-mpeg4-15fps.mpg

* I got 14 fps, lower than the same encoding without framerate change!
Code: Select all
General
Complete name                    : nu-merge-mpeg4-15fps.mpg
Format                           : MPEG-PS
File size                        : 3.90 MiB
Duration                         : 3mn 29s
Overall bit rate                 : 156 Kbps
Writing library                  : Lavc52.83.0

Video
ID                               : 224 (0xE0)
Format                           : MPEG-4 Visual
Format profile                   : Simple@L1
Format settings, BVOP            : No
Format settings, QPel            : No
Format settings, GMC             : No warppoints
Format settings, Matrix          : Default (H.263)
Duration                         : 3mn 29s
Bit rate                         : 142 Kbps
Width                            : 320 pixels
Height                           : 240 pixels
Display aspect ratio             : 4:3
Resolution                       : 24 bits
Colorimetry                      : 4:2:0
Scan type                        : Progressive
Stream size                      : 3.54 MiB (91%)
Writing library                  : Lavc52.83.0

Audio
ID                               : 192 (0xC0)
Format                           : MPEG Audio
Format version                   : Version 2
Format profile                   : Layer 3
Format_Settings_Mode             : Joint stereo / MS Stereo
Duration                         : 3mn 29s
Bit rate mode                    : Constant
Bit rate                         : 8 000 bps
Channel(s)                       : 2 channels
Sampling rate                    : 22.05 KHz
Resolution                       : 16 bits
Stream size                      : 204 KiB (5%)


3. mpeg4 @ 5fps ( slide-show mode, just for fun)
Code: Select all
time ffmpeg -i nu-merge.flv -acodec copy -b 100k -r 5 -vcodec mpeg4 nu-merge-mpeg4-5fps.mpg

* counter-intuitively, I got just 8 fps! It seems the more you change the framerate, the more it has to process...
Code: Select all
General
Complete name                    : nu-merge-mpeg4-5fps.mpg
Format                           : MPEG-PS
File size                        : 4.61 MiB
Duration                         : 4mn 14s
Overall bit rate                 : 152 Kbps
Writing library                  : Lavc52.83.0

Video
ID                               : 224 (0xE0)
Format                           : MPEG-4 Visual
Format profile                   : Simple@L1
Format settings, BVOP            : No
Format settings, QPel            : No
Format settings, GMC             : No warppoints
Format settings, Matrix          : Default (H.263)
Duration                         : 4mn 14s
Bit rate                         : 138 Kbps
Width                            : 320 pixels
Height                           : 240 pixels
Display aspect ratio             : 4:3
Resolution                       : 24 bits
Colorimetry                      : 4:2:0
Scan type                        : Progressive
Stream size                      : 4.19 MiB (91%)
Writing library                  : Lavc52.83.0

Audio
ID                               : 192 (0xC0)
Format                           : MPEG Audio
Format version                   : Version 2
Format profile                   : Layer 3
Format_Settings_Mode             : Joint stereo / MS Stereo
Duration                         : 4mn 14s
Bit rate mode                    : Constant
Bit rate                         : 8 000 bps
Channel(s)                       : 2 channels
Sampling rate                    : 22.05 KHz
Resolution                       : 16 bits
Stream size                      : 248 KiB (5%)


Sadly I'm out of ideas, so I'm throwing in the towel (for now)...
foxer
WDTVer
 
Posts: 48
Joined: Wed Nov 24, 2010 9:45 am

Re: ffmpeg transcoding on the wdtv - success and failure   

Postby mad_ady » Sun Nov 25, 2012 11:53 pm

I'm reviving this thread because now I'm looking for a reliable transcoding solution.

Here's my problem: I'm trying to convert H.264 video + PCM audio that comes in a RTSP stream to something the WDTV will play. Since H.264 is supported by the wdtv, I thought I only need to do a container conversion, without any heavy video transcoding. My input framerate is 15fps (an IP Camera).

So, here are my experiments (note, I used recliq's ffmpeg build of 0.11.2):

Input stream:
Input #0, rtsp, from 'rtsp://192.168.1.10/camera-h264-stream.sdp':
Metadata:
title : IPCam
Duration: N/A, start: 0.000000, bitrate: 64 kb/s
Stream #0:0: Video: h264 (Baseline), yuv420p, 640x480, 49.92 tbr, 90k tbn, 180k tbc
Stream #0:1: Audio: pcm_alaw, 8000 Hz, mono, s16, 64 kb/s


* Encoding as AVI (copy streams):
ffmpeg -rtsp_transport tcp -i rtsp://192.168.1.10/camera-h264-stream.sdp -acodec copy -vcodec copy -f avi h264-pcm-avi.avi

Immediately dies with this error message: Too large number of skiped frames 71899

* Encoding as AVI (transcode video as MJPEG):
ffmpeg -rtsp_transport tcp -i rtsp://192.168.1.10/camera-h264-stream.sdp -acodec copy -vcodec mjpeg -f avi mjpeg-pcm-avi.avi

~1fps, plays back, no sound

* Encoding as AVI with high bitrate MJPEG:
ffmpeg -rtsp_transport tcp -i rtsp://192.168.1.10/camera-h264-stream.sdp -acodec copy -vcodec mjpeg -b:v 10000k -g 0 -q 1 -f avi mjpeg_high-pcm-avi.avi

~0.6fps, plays back, no sound

* Encoding as FLV (copy video stream, no audio):
ffmpeg -rtsp_transport tcp -i rtsp://192.168.1.10/camera-h264-stream.sdp -an -vcodec copy -f flv h264-none-flv.flv

~13-14fps, plays video accelerated (playback at 24 fps)

* Encoding as FLV - audio as mp2
ffmpeg -rtsp_transport tcp -i rtsp://192.168.1.10/camera-h264-stream.sdp -acodec mp2 -vcodec copy -f flv h264-mp2-flv.flv

Dies with error [flv @ 0x44cf10] codec not compatible with flv

* Encoding as FLV - audio as AAC
ffmpeg -rtsp_transport tcp -i rtsp://192.168.1.10/camera-h264-stream.sdp -acodec aac -ab 64k -ar 16000 -ac 1 -vcodec copy -f flv h264-aac-flv.flv

Dies with error: Error while opening encoder for output stream #0:1 - maybe incorrect parameters such as bit_rate, rate, width or height

* Encoding as MKV - copy streams:

ffmpeg -rtsp_transport tcp -i rtsp://192.168.1.10/camera-h264-stream.sdp -acodec copy -vcodec copy -f matroska h264-pcm-mkv.mkv

12 fps, shows just a frozen frame, no sound

* Encoding as MKV - video encoded in MJPEG, copy audio
ffmpeg -rtsp_transport tcp -i rtsp://192.168.1.10/camera-h264-stream.sdp -acodec copy -vcodec mjpeg -b:v 10000k -g 0 -q 1 -f matroska mjpeg-pcm-mkv.mkv

0.6 fps, does not play back (unsupported format)

* Encoding as MKV - video copy, audio mp2
ffmpeg -rtsp_transport tcp -i rtsp://192.168.1.10/camera-h264-stream.sdp -acodec mp2 -vcodec copy -f matroska h264-mp2-mkv.mkv

9 fps, plays with black screen and no sound

* Encoding as MP4 - copy streams:
ffmpeg -rtsp_transport tcp -i rtsp://192.168.1.10/camera-h264-stream.sdp -acodec copy -vcodec copy -f mp4 h264-pcm-mp4.mp4

Dies with error: [mp4 @ 0x44cf10] track 1: could not find tag, codec not currently supported in container

* Encoding as MP4 - copy video, audio as mp2
ffmpeg -rtsp_transport tcp -i rtsp://192.168.1.10/camera-h264-stream.sdp -acodec mp2 -vcodec copy -f mp4 h264-mp2-mp4.mp4

~ 10 fps, plays video, choppy audio
but when I try to write the output to a pipe (instead of a file) I get this error: [mp4 @ 0x44cf10] muxer does not support non seekable output

* Encoding as MOV - copy streams

ffmpeg -rtsp_transport tcp -i rtsp://192.168.1.10/camera-h264-stream.sdp -acodec copy -vcodec copy -f mov h264-pcm-mov.mov

~3-6 fps, plays video low fps, no audio

* Encoding as MOV - audio as mp2:
ffmpeg -rtsp_transport tcp -i rtsp://192.168.1.10/camera-h264-stream.sdp -acodec mp2 -vcodec copy -f mov h264-mp2-mov.mov

~ 9.5 fps, plays video, no audio but when trying to write to a pipe instead of file it dies with [mov @ 0x44cf10] muxer does not support non seekable output

* Encoding as MPEGTS - copy streams:
ffmpeg -rtsp_transport tcp -i rtsp://192.168.1.10/camera-h264-stream.sdp -acodec copy -vcodec copy -f mpegts h264-pcm-mpegts.ts

~ 12-13 fps, plays black video, no audio

* Encoding as MPEGTS - encode as mpeg2:
ffmpeg -rtsp_transport tcp -i rtsp://192.168.1.10/camera-h264-stream.sdp -f mpegts mpeg2-mp2-mpegts.ts

~ 4-5 fps, plays back, also works when writing to a pipe and eventually plays back onscreen

I intend to do some other tests as well, and experiment with avi some more, but so far, I get the following conclusions:
1. Not all containers are suitable for live streaming. The ones that worked the best with un-transcoded h.264 (mp4 and mov) don't work while in pipe mode. Maybe there are some parameters to be tuned.
2. To get the fastest playback on the wdtv you would need the highest bitrate out of ffmpeg so that you can quickly fill MediaLogic's buffer. Encoded video in mpegts/mpeg2 has a low bitrate and it may take more than 2 minutes of buffering before anything starts to play back - not that good for live video :(
3. MKV strangely doesn't work as expected...
4. There is a workaround for getting the cake and eating it - for example, one could write mp4 to a file at 10fps and have MediaLogic read from a file instead of a pipe. I haven't tried it yet, but it should work. The price to pay is - you need storage to write the file to.

I am open to suggestions on what format I should look into more or what other ffmpeg parameters I can try to tune...
User avatar
mad_ady
Developer
 
Posts: 4570
Joined: Fri Nov 05, 2010 9:08 am
Location: Bucharest, Romania

Next

Return to UMSP Media Server

Who is online

Users browsing this forum: No registered users and 3 guests

cron