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

Re: ffmpeg transcoding on the wdtv - success and failure   

Postby DJArty » Tue Nov 27, 2012 12:10 am

Tested e.g. with external rtsp://flash.cdn.deluxemusic.tv/deluxemusic.tv-live/web_850.stream
and my beta iptvv3 - video work on WD.. but something wrong with sound.. (for exactly this link).
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 mad_ady » Tue Nov 27, 2012 12:18 am

I've tried with your link and I get the same warnings about h264_mp4toannexb I got before, so if it works for you it should work for me too. :)

Regarding audio - you could try converting aac to mp2 - shouldn't be too CPU intensive... At least mp2 seems to play fine inside mpegts...

Also, regading the input stream, I can spot one important difference - your stream has the framerate detected correctly (25fps), while mine has no framerate detected. Perhaps I need to force the source framerate... I will test it and let you know
User avatar
mad_ady
Developer
 
Posts: 4570
Joined: Fri Nov 05, 2010 9:08 am
Location: Bucharest, Romania

Re: ffmpeg transcoding on the wdtv - success and failure   

Postby mutulaki » Tue Nov 27, 2012 4:29 am

Hi mad_ady,

I have compiled openRTSP for wdlxtv. But i don't have any stream to test it. Can you test it and tell me how it works with your stream?

http://mc.tt/8fymJjOQ8I

Here is documentation of openRTSP: http://www.live555.com/openRTSP/

Simple usage is : openRTSP -4 URL
to output a '.mp4'-format file to 'stdout', URL is in "rtsp://..." form

but you have a lot of commands if you want to play with it.

Thanks for all what you are doing for wdlxtv and best regards,

M
mutulaki
DLX'er
 
Posts: 134
Joined: Thu Feb 02, 2012 1:38 am

Re: ffmpeg transcoding on the wdtv - success and failure   

Postby mad_ady » Tue Nov 27, 2012 4:59 am

Thanks - I'll give it a try. In the meantime you can test with DJArty's link (it's accessible).

In my case I need to set RTSP interleaved mode in order to pass through a couple of NATs (I'll have to look how OpenRTSP does that).
User avatar
mad_ady
Developer
 
Posts: 4570
Joined: Fri Nov 05, 2010 9:08 am
Location: Bucharest, Romania

Re: ffmpeg transcoding on the wdtv - success and failure   

Postby mad_ady » Tue Nov 27, 2012 7:36 am

So, I tried out DJArty's suggestion, but I still couldn't get the video to play on the wdtv. It plays fine in VLC though (you can notice skipped frames a lot though):

ffmpeg -re -vf fps:15 -rtsp_transport tcp -i rtsp://192.168.1.10/camera-h264-stream.sdp -acodec mp2 -vcodec copy -vbsf h264_mp4toannexb -f matroska h264-annexb-mp2-mkv.mkv


I get about 6fps, and I get a black screen with no sound on playback.

ffmpeg -re -vf fps:15 -rtsp_transport tcp -i rtsp://192.168.1.10/camera-h264-stream.sdp -acodec mp2 -vcodec copy -vbsf h264_mp4toannexb -f mpegts h264-annexb-mp2-mpegts.ts


I get about 9fps, but still a black image with no sound on playback...

When I tried DJArty's stream, I did get an image (skipped a lot) but no sound - so there are differences in the streams...

@DJArty - if you want I can capture a 1 minute stream from my camera and send it to you to play with it, but the question is - how should I save it in order not to change/damage the content?

Abandoning the h264 output for a moment, I went in to explore some settings that would generate decent mpeg2 content:

#1. Use -sameq to keep the same quantizers between input and output (ideally keeping the input image quality).
ffmpeg -re -vf fps:15 -rtsp_transport tcp -i rtsp://192.168.1.10/camera-h264-stream.sdp -acodec mp2 -sameq -f mpegts mpeg2-sameq-mp2-mpegts.ts


It creates playable content, but at 2fps and without sound...

#2. Use some random parameters found on various sites:
ffmpeg -re -vf fps:15 -rtsp_transport tcp -i rtsp://192.168.1.10/camera-h264-stream.sdp -acodec mp2 -vcodec mpeg2video -me_method zero -r 25 -g 15 -b:v 3000k -bt:v 1000k -f mpegts mpeg2-test1-mp2-mpegts.ts


It also creates playable content, with sound, at 2.2fps...

#3. Less quality:
ffmpeg -re -vf fps:15 -rtsp_transport tcp -i rtsp://192.168.1.10/camera-h264-stream.sdp -acodec mp2 -vcodec mpeg2video -me_method zero -r 25 -g 100 -b:v 1000k -bt:v 100k -f mpegts mpeg2-test2-mp2-mpegts.ts


I managed to get 3.4 fps with this setting...

The problem is - the lower the quality - the lower the output bitrare, and the longer it will take for the player to buffer the content. I wonder if I can artificially add a second sound track and fill it with high-bitrate silence just to force the player's buffer to play back sooner...
User avatar
mad_ady
Developer
 
Posts: 4570
Joined: Fri Nov 05, 2010 9:08 am
Location: Bucharest, Romania

Re: ffmpeg transcoding on the wdtv - success and failure   

Postby DJArty » Tue Nov 27, 2012 10:22 am

Looks like your camera is very cool :) (about wanted image quality) And what for sound on IP-cam, Web-cam?
May be try to change camera output format if possible...
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 mad_ady » Tue Nov 27, 2012 10:38 am

The camera I'm streaming of is a Edimax IC-7110W IP Camera. Sound (through RTSP) comes as PCM A-Law, 8000Hz, Mono - basically landline telephone quality...

The camera supports two RTSP streams - one H264 (the one I'm testing with) and a mpeg4 version - which doesn't even play in VLC (but plays in the ActiveX controller that runs in Internet Explorer)...

Most likely they are not implementing the standard fully, or maybe there is a different ffmpeg switch I need to use to make the wdtv happy...
User avatar
mad_ady
Developer
 
Posts: 4570
Joined: Fri Nov 05, 2010 9:08 am
Location: Bucharest, Romania

Re: ffmpeg transcoding on the wdtv - success and failure   

Postby mad_ady » Wed Nov 28, 2012 8:43 am

I did one more test (well, one more meaningful test anyway)...

Encoded a file with these parameters (about 1:15 duration):
Code: Select all
ffmpeg -fflags 'discardcorrupt'  -vf fps:15 -rtsp_transport tcp -i rtsp://192.168.1.10/camera-h264-stream.sdp -acodec mp2 -vcodec copy -async 1 -f mpegts h264-copy1-mp2.mpegts.m2ts


Mediainfo for the file looks like this:
Code: Select all
General
ID                               : 1
Complete name                    : h264-copy1-mp2.mpegts.m2ts
Format                           : BDAV
Format/Info                      : Blu-ray Video
File size                        : 6.82 MiB
Duration                         : 1mn 15s
Overall bit rate                 : 755 Kbps

Video
ID                               : 256 (0x100)
Menu ID                          : 1 (0x1)
Format                           : AVC
Format/Info                      : Advanced Video Codec
Duration                         : 1mn 15s
Bit rate                         : 588 Kbps
Stream size                      : 5.30 MiB (78%)

Audio
ID                               : 257 (0x101)
Menu ID                          : 1 (0x1)
Format                           : MPEG Audio
Format version                   : Version 2
Format profile                   : Layer 2
Duration                         : 1mn 15s
Bit rate mode                    : Constant
Bit rate                         : 128 Kbps
Channel(s)                       : 1 channel
Sampling rate                    : 16.0 KHz
Resolution                       : 16 bits
Video delay                      : -31ms
Stream size                      : 1.16 MiB (17%)

Menu
ID                               : 4096 (0x1000)
Menu ID                          : 1 (0x1)
List                             : 256 (0x100) (AVC) / 257 (0x101) (MPEG Audio)
Service name                     : IPCam
Service provider                 : FFmpeg
Service type                     : digital television


If I play it in VLC, I don't get any image, but it plays the sound. If I play it on the wdtv, I don't get any image and it plays the first 2-3 seconds of sound and then exits. MediaLogic running in debug mode outputs the following:

Code: Select all
CODE_PLAY :logic/RenderLogic.c :1222 speed:1
[INFO:MediaPlayer:mp_open:261]enter 1354120216
[INFO:MediaPlayer:MA_ParseMetaData:268]metaData->fullUrl file:///tmp/media/usb/USB2/6c67aa8a-e447-4f27-be88-150f6f42fceb/test-video/h264-copy1-mp2.mpegts.m2ts
./src/httpAPI/url.c,url_init,416 server ip:255.255.255.255, local ip:192.168.1.4, netmask:255.255.255.0
[INFO:MediaPlayer:MA_ParseMetaData:276]the service type is 5
[INFO:MediaPlayer:MA_ParseMetaData:417]metaData->fileSize=5
[INFO:MediaPlayer:MA_ParseMetaData:439]duration=0,width=0,height=0
Get parseRet = 5 protection_type = 0
[INFO:MediaPlayer:mp_open:336]Before escape=///tmp/media/usb/USB2/6c67aa8a-e447-4f27-be88-150f6f42fceb/test-video/h264-copy1-mp2.mpegts.m2ts
[INFO:MediaPlayer:mp_open:339]After escape=///tmp/media/usb/USB2/6c67aa8a-e447-4f27-be88-150f6f42fceb/test-video/h264-copy1-mp2.mpegts.m2ts
mime_type=video/mpeg2ts
suffix=/tmp/media/usb/USB2/6c67aa8a-e447-4f27-be88-150f6f42fceb/test-video/h264-copy1-mp2.mpegts.m2ts
MA_SelectPlayOPByCheckFile : ret = 26
SMD_SendFreeCommand enter
SMD_SendCommand 8
SMD_GetCommand 4 8
[INFO:MediaPlayer:mp_open:409]MP_CreateInstance start the avopen



playerContext->msubType = 6
m2ts_name = (null) m2ts_size = 725850448
[INFO:MediaPlayer:NBread_write:1000]return value of read is 0
is_stream_eof
pos > end_pos Or end of stream
VIDEO H264(pid=256) MPEG Layer 2(pid=257) NO SUBS (yet)!  PROGRAM N. 1
start_pos = 0x304
stream.ts_start_pos = 4
start_pos = 0x4
Search VIDEO 1b (pid=256)
Warring: pid = 0x100(256) stream type = 0x1b is not reliable! Need to Identify stream type.
Search AUDIO 3 (pid=257)
samplerate = 16000
bitsample = 0
channels = 1
[INFO:MediaPlayer:NBread_write:1000]return value of read is 0
THIS DOESN'T LOOK LIKE AN MPEG-TS FILE!
Add pid = 0x0100, track_type = 0, stream_type = 0x1b, lang =
Add pid = 0x0101, track_type = 1, stream_type = 0x03, lang =
transport_stream_parser ok!
[INFO:MediaPlayer:player_trans_v_codec:1604]codec_in: H264 video
[INFO:MediaPlayer:player_trans_a_codec:1528]codec_in: MPEG1 audio
[INFO:MediaPlayer:player_trans_a_codec:1528]codec_in: MPEG1 audio
TS audio codec =03 101
[INFO:MediaPlayer:player_trans_a_codec:1528]codec_in: MPEG1 audio
[ERR:MediaPlayer:player_fill_trackinfo:1727]TS don't has subtitle codec.
[INFO:MediaPlayer:em86psfdemuxParse:7408]RM_SYSTEM_MPEG2_TRANSPORT_192
[INFO:MediaPlayer:em86psfdemuxParse:7513]SourceType ----> M2T_192
#########duration = 1098 bitrate = 52
TS192, use High Buf
em8620_open_dcc:357, Open DCC for player is_pic = 0
********************* em8620_open_dcc:390, DCC is  opening.
securesoho_ntsc_pal_get_inner[1532], PAL
em86xx_dev_set_tvdisp, 1819: cs=0
sal_disp_opt->no_display is true
Enter InitPSFTableVariables.
Starting MMAP
End MMAP 0x0x2f9b4000
Starting MMAP
End MMAP 0x0x2fa34000
Starting MMAP
End MMAP 0x0x2fa44000
Starting MMAP
End MMAP 0x0x2fa54000
Starting MMAP
End MMAP 0x0x2fa64000
Starting MMAP
End MMAP 0x0x2fa74000
Starting MMAP
End MMAP 0x0x2fa84000
Starting MMAP
End MMAP 0x0x2fa94000
Starting MMAP
End MMAP 0x0x2faa4000
Starting MMAP
End MMAP 0x0x2fac4000
Starting MMAP
End MMAP 0x0x2fb44000
Starting MMAP
End MMAP 0x0x2fb64000
Starting MMAP
End MMAP 0x0x2fb84000
Starting MMAP
End MMAP 0x0x2fba4000
Starting MMAP
End MMAP 0x0x2fbc4000
connect consumer=0x20000
connect consumer=0x20000
connect consumer=0x20000
[INFO:MediaPlayer:OpenPSFVideoDecoder:4700] video_opt width:0, height:0, videocodec:22
[hdmi_srm.c:110] Providing empty, valid HDCP SRM.
[hdmi_srm.c:30] No filename for the persistent SRM file has been specified!
[hdmi_rua.c:300] [HDMI] WARNING! Please use hdmi_clear_context() to intialize the dh_context
[hdmi_rua.c:398] [HDMI] Probing for HDMI core on internal bus.
[probe.c:272] [HDMI] find: Detected part at I2C device address 0x72: vendor 0x0010, device 802d, rev.0xf0 (Silicon Library)
[hdmi.c:277] [HDMI] Found chip 1 at 0x72
[hdmi_rua.c:401] [HDMI] Found 1 HDMI core on internal bus.
[hdmi_rua.c:408] [HDMI] about to hdmi_open chip 0 at 0x72
[hdmi.c:317] [HDMI] Selecting internal chip at I2C device address 0x72
[probe.c:364] [HDMI] select: Detected part: vendor 0x0010, device 802d, rev.0xf0 (Silicon Library)
[hdmi.c:194] [HDMI] ========================== creating pHDMI ==========================
[SLi.c:74] SLi13T Revision: 0.63, PHY 85 nm
[SLi.c:149]    [HDMI] RESET PLL  ---------------------------------------------------
[SLi.c:178] mode.b DDC timing setup from Intl clk: div=315 for a DDC clock of 23809 Hz
[hdmi_rua.c:423] [HDMI] Probing for HDMI chips on I2C bus.
[hdmi_rua.c:426] [HDMI] Found 0 HDMI chips on I2C bus.
[hdmi_rua.c:470] [HDMI] found 1 HDMI chip
[srm.c:57] hdmi_check_signature(0x625c80, 40, 0x625c78, 8)
  SRM Data[00]: 80 00 00 01 00 00 00 2B
  SRM Sig.[00]: D2 48 9E 49 D0 57 AE 31
  SRM Sig.[08]: 5B 1A BC E0 0E 4F 6B 92
  SRM Sig.[10]: A6 BA 03 3B 98 CC ED 4A
  SRM Sig.[18]: 97 8F 5D D2 27 29 25 19
  SRM Sig.[20]: A5 D5 F0 5D 5E 56 3D 0E
[hdmi_rua.c:559] [HDMI] Opening CEC chip.
[hdmi.c:529] [HDMI] ========================== creating pCEC ==========================
[hdmi_rua.c:592] [CEC] Registering source device
[hdmi_srm.c:208] Error: could not open HDCP SRM file "/cdrom/"
video demux output index 2
module 0x1a connected to output 0x22d (index 2)
[INFO:MediaPlayer:OpenPSFOutputTableForPlayback:5330]set video time scale: 90000 ticks per second
connect consumer=0x1a
[INFO:MediaPlayer:OpenPSFAudioDecoder:4843]AudioCodec:101,samplerate:16000, nochannel:1, bitsample:0, psm_audio_pid:0x0
audio demux output index 3, module 0x1c
module 0x1c connected to output 0x32d (index 3)
[INFO:MediaPlayer:OpenPSFOutputTableForPlayback:5358]set triggers for audio output 3
audio_ts_priority = 0 demux_output = 32d
connect consumer=0x1c
connect consumer=0x1c
connect consumer=0x1c
connect consumer=0x1c
connect consumer=0x1c
connect consumer=0x1c
connect consumer=0x1c
connect consumer=0x1c
connect consumer=0x1c
connect consumer=0x1c
connect consumer=0x1c
connect consumer=0x1c
connect consumer=0x1c
connect consumer=0x1c
connect consumer=0x1c
[INFO:MediaPlayer:SetPSFAVPlayback:5937]Enter SetPSFAVPlayback.
trickBuffersToSend  = 0
securesoho_ntsc_pal_get_inner[1532], PAL
securesoho_ntsc_pal_get_inner[1532], PAL
securesoho_ntsc_pal_get_inner[1532], PAL
securesoho_ntsc_pal_get_inner[1532], PAL
em8620_set_vol:1103, gs_volume=100
set_vol:680, right=100,left=100
Volume = 0x10000000
[INFO:MediaPlayer:em86psfdemuxParse:7627]create_file_stream!


      ######## pipe_release #########


[INFO:MediaPlayer:InitPGSDemux:683]Enter InitPGSDemux.
max_num = 0
[INFO:MediaPlayer:mp_open:455]Leave MP_CreateInstance correctly
LGAction CODE_BUFFERING_STATUS!!
[INFO:MediaPlayer:em86psfdemuxOp:8312]G_CTL_GET_AUDIOTRACK_INFO, cur=0,total=1
LGAction CODE_SUBTITLE:!!,logic/RenderLogic.c:771 totalsubtitle = 0
[INFO:MediaPlayer:mp_play:769]MediaPlay(-1 1)
[INFO:MediaPlayer:mp_play:785]MediaPlay(-1 1)
# LGTransition, LG->Speed = LG->Event->speed, = 0
buffering state = 2 check_type = 0



llInitTime = -1


FirstSystemTime count:32768
got pcr = 0 stc=0
[INFO:MediaPlayer:PSFPATCallback:1254]PAT SET!



llInitTime = 130446


got pcr = 126000 stc=0
Force to play at Func: EM86xx/3_7_0/em86_psfPlayer.c Line: 10263
   
*****************************EM86xx/3_7_0/em86_psfPlayer.c 8641
STC = 1175418 (13 secs)
Video :   
Data 1a: st=87feb000 sz=16777216 wr=13403463 rd=3373752 --> f : 20.11
XFER 1a: st=87feb000 sz=16777216 wr=13403463 rd=3373752 er=0 --> f : 20.11   
*****************************  8641
use pcr to set DCCSTCSetTime = 126000 90000
[INFO:MediaPlayer:em86psfdemuxOp:8312]G_CTL_GET_AUDIOTRACK_INFO, cur=0,total=1
LGAction CODE_SUBTITLE:!!,logic/RenderLogic.c:1800 totalsubtitle = 0
PlayerCalCulateMoveDestWin : set dest win = (360,240,720,480)
PlayerCalCulateMoveDestWin : after reset : the  dest win = (360,240,720,480) zoom_mode = 6(0.900000)
set_relative_window_size : set the  dest win = (2048,2048,3680,3677)
[ERR:MediaPlayer:em86psfdemuxReadLoop:10639]Tasks->wait_eos_state :4
[INFO:MediaPlayer:em86psfdemuxReadLoop:11049]=WaitForEOS demux OK event_index=2
[ERR:MediaPlayer:em86psfdemuxReadLoop:11050]Tasks->wait_eos_state :3
[INFO:MediaPlayer:em86psfdemuxReadLoop:11075]WaitForEOS video OK event_index=3
[ERR:MediaPlayer:em86psfdemuxReadLoop:11076]Tasks->wait_eos_state :2
[ERR:MediaPlayer:em86psfdemuxReadLoop:11136]Tasks->wait_eos_state :1
[INFO:MediaPlayer:em86psfdemuxReadLoop:11137]WaitForEOS display OK event_index=4
Got MIFO_EOS
em86psfdemuxReadLoop thread exit
[INFO:MediaPlayer:mp_stop:532]enter : wait player thread to exit.
[INFO:MediaPlayer:em86HwStop:2562]Enter em86HwStop.
[INFO:MediaPlayer:mp_stop:601]Leave DeleteInstance
Enter em86psfdemuxClose.
em8620_close_dcc:415, Close DCC for player



It seems to detect the correct codecs, but then it says "THIS DOESN'T LOOK LIKE AN MPEG-TS FILE!"... Maybe this is some meaningless debug statement, or maybe there is a problem with the file...

I will retest with the -bsf:v h264_mp4toannexb option set, but the camera went offline right now...
User avatar
mad_ady
Developer
 
Posts: 4570
Joined: Fri Nov 05, 2010 9:08 am
Location: Bucharest, Romania

Re: ffmpeg transcoding on the wdtv - success and failure   

Postby mad_ady » Thu Nov 29, 2012 2:04 am

Ok, I've made a recording with the -bsf:v h264_mp4toannexb option set, but still the file plays with no video (audio only) in VLC:

ffmpeg -fflags 'discardcorrupt' -vf fps:15 -rtsp_transport tcp -i rtsp://192.168.1.10/camera-h264-stream.sdp -acodec mp2 -vcodec copy -async 1 -bsf:v h264_mp4toannexb -f mpegts h264-copy2-mp2.mpegts.m2ts


So, I'm giving up the mpegts route - for now...

Next on my agenda was trying to get avi format working - because the camera can save h264 inside AVI.

I saved a motion capture video from the camera's menu, and played it through VLC. It plays just fine, the only issue is the first few frames are distorted because recording didn't start with an I frame. As soon as the I-Frame arrives, playback is smooth. Problem is - it doesn't record audio... Mediainfo for the file is the following:
Code: Select all
root@Deneb:/tmp/mnt/6c67aa8a-e447-4f27-be88-150f6f42fceb/test-video# mediainfo Motion_2012-11-29_10-14-11.avi
General
Complete name                    : Motion_2012-11-29_10-14-11.avi
Format                           : AVI
Format/Info                      : Audio Video Interleave
File size                        : 450 KiB
Duration                         : 10s 16ms
Overall bit rate                 : 368 Kbps
Writing application              : Lavf52.23.1

Video
ID                               : 0
Format                           : AVC
Format/Info                      : Advanced Video Codec
Codec ID                         : H264
Duration                         : 10s 16ms
Bit rate                         : 361 Kbps
Width                            : 640 pixels
Height                           : 480 pixels
Display aspect ratio             : 4:3
Frame rate                       : 12.680 fps
Resolution                       : 24 bits
Bits/(Pixel*Frame)               : 0.093
Stream size                      : 441 KiB (98%) / 441 KiB (98%)


I haven't tried playing this file on the WDTV, but I will try tonight.

Next, I went snooping around the camera's firmware (got a chance to learn new things: http://adrianpopagh.blogspot.ro/2012/11/extracting-firmware-for-edimax-ic-7110w.html) and I noticed two files sitting in /etc: avi_header.dat and avi_header_h264.dat. I think that when saving files, the camera's software writes these headers and then dumps the h264 stream directly to file...

The h264 header is decoded as follows:
Code: Select all
root@Deneb:/tmp/mnt/6c67aa8a-e447-4f27-be88-150f6f42fceb/test-video# mediainfo avi_header_h264.dat
General
Complete name                    : avi_header_h264.dat
Format                           : AVI
Format/Info                      : Audio Video Interleave
File size                        : 5.54 KiB
Duration                         : 5s 521ms
Overall bit rate                 : 8 218 bps
Writing application              : Lavf52.23.1

Video
ID                               : 0
Format                           : AVC
Format/Info                      : Advanced Video Codec
Codec ID                         : H264
Duration                         : 5s 521ms
Width                            : 640 pixels
Height                           : 480 pixels
Display aspect ratio             : 4:3
Frame rate                       : 25.720 fps
Resolution                       : 24 bits


So, my plan was to dump the raw video stream (still encoded in h264) to a file, and concatenate it with the header to get a playable avi file:
Code: Select all
root@Deneb:/tmp/mnt/6c67aa8a-e447-4f27-be88-150f6f42fceb/test-video# ffmpeg -re -vf fps:15 -rtsp_transport tcp -i rtsp://192.168.1.10/camera-h264-
stream.sdp -acodec copy -vcodec copy -r 15 -f rawvideo h264-pcm-raw
ffmpeg version 0.11.2 Copyright (c) 2000-2012 the FFmpeg developers
  built on Nov 15 2012 17:48:06 with gcc 4.3.2
  configuration: --prefix=/apps/ffmpeg --enable-cross-compile --arch=mipsel --target-os=linux --cc=/opt/mips-4.3/bin/mipsel-linux-gcc --strip=/opt/mips-4.3/bin/mipsel-linux-strip --disable-doc --disable-static --enable-shared --disable-yasm
  libavutil      51. 54.100 / 51. 54.100
  libavcodec     54. 23.100 / 54. 23.100
  libavformat    54.  6.100 / 54.  6.100
  libavdevice    54.  0.100 / 54.  0.100
  libavfilter     2. 77.100 /  2. 77.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0. 15.100 /  0. 15.100
[rtsp @ 0x43c4f0] Estimating duration from bitrate, this may be inaccurate
Guessed Channel Layout for  Input Stream #0.1 : mono
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
File 'h264-pcm-raw' already exists. Overwrite ? [y/N] y
Output #0, rawvideo, to 'h264-pcm-raw':
  Metadata:
    title           : IPCam
    encoder         : Lavf54.6.100
    Stream #0:0: Video: h264, yuv420p, 640x480, q=2-31, 90k tbn, 90k tbc
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
frame=  868 fps= 12 q=-1.0 Lsize=    1933kB time=00:01:10.45 bitrate= 224.7kbits/s     
video:1933kB audio:0kB global headers:0kB muxing overhead 0.000000%
root@Deneb:/tmp/mnt/6c67aa8a-e447-4f27-be88-150f6f42fceb/test-video# cat avi_header_h264.dat h264-pcm-raw > h264-none-composed_from_avi_header.avi
root@Deneb:/tmp/mnt/6c67aa8a-e447-4f27-be88-150f6f42fceb/test-video# ls -l avi_header_h264.dat
-rwx------    1 root     root          5672 Nov 29 11:27 avi_header_h264.dat

root@Deneb:/tmp/mnt/6c67aa8a-e447-4f27-be88-150f6f42fceb/test-video# mediainfo h264-pcm-raw
General
Complete name                    : h264-pcm-raw
File size                        : 1.89 MiB


root@Deneb:/tmp/mnt/6c67aa8a-e447-4f27-be88-150f6f42fceb/test-video# mediainfo h264-none-composed_from_avi_header.avi
General
Complete name                    : h264-none-composed_from_avi_header.avi
Format                           : AVI
Format/Info                      : Audio Video Interleave
File size                        : 1.89 MiB
Duration                         : 5s 521ms
Overall bit rate                 : 2 876 Kbps
Writing application              : Lavf52.23.1

Video
ID                               : 0
Format                           : AVC
Format/Info                      : Advanced Video Codec
Codec ID                         : H264
Duration                         : 5s 521ms
Bit rate                         : 2 755 Kbps
Width                            : 640 pixels
Height                           : 480 pixels
Display aspect ratio             : 4:3
Frame rate                       : 25.720 fps
Resolution                       : 24 bits
Bits/(Pixel*Frame)               : 0.349
Stream size                      : 1.81 MiB (96%)


I tried to play this video through VLC, and sadly it doesn't play (complains about broken indexes, but doesn't play anything even after rebuilding indexes).

Why this convoluted approach? Because when I tried to create an avi file with ffmpeg it complained or got stuck after one frame:
Code: Select all
root@Deneb:/tmp/mnt/6c67aa8a-e447-4f27-be88-150f6f42fceb/test-video# ffmpeg -re -vf fps:15 -rtsp_transport tcp -i rtsp://192.168.1.10/camera-h264-
stream.sdp -acodec copy -vcodec copy -r 25 -f avi h264-pcm-avi.avi
ffmpeg version 0.11.2 Copyright (c) 2000-2012 the FFmpeg developers
  built on Nov 15 2012 17:48:06 with gcc 4.3.2
  configuration: --prefix=/apps/ffmpeg --enable-cross-compile --arch=mipsel --target-os=linux --cc=/opt/mips-4.3/bin/mipsel-linux-gcc --strip=/opt/mips-4.3/bin/mipsel-linux-strip --disable-doc --disable-static --enable-shared --disable-yasm
  libavutil      51. 54.100 / 51. 54.100
  libavcodec     54. 23.100 / 54. 23.100
  libavformat    54.  6.100 / 54.  6.100
  libavdevice    54.  0.100 / 54.  0.100
  libavfilter     2. 77.100 /  2. 77.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0. 15.100 /  0. 15.100
[rtsp @ 0x43c4f0] Estimating duration from bitrate, this may be inaccurate
Guessed Channel Layout for  Input Stream #0.1 : mono
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
File 'h264-pcm-avi.avi' already exists. Overwrite ? [y/N] y
Output #0, avi, to 'h264-pcm-avi.avi':
  Metadata:
    INAM            : IPCam
    ISFT            : Lavf54.6.100
    Stream #0:0: Video: h264 (H264 / 0x34363248), yuv420p, 640x480, q=2-31, 90k tbn, 90k tbc
    Stream #0:1: Audio: pcm_alaw ([6][0][0][0] / 0x0006), 8000 Hz, mono, 64 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
Too large number of skiped frames 105650kB time=00:00:00.00 bitrate=   0.0kbits/s   
av_interleaved_write_frame(): Invalid argument


Ugh... this was supposed to be an easy task - the format is supposed to be supported on the wdtv (and works inside mp4 or mov files), but it fails in other containers... I feel I'm wasting my time with this, and yet, it feels so close... :evil:
User avatar
mad_ady
Developer
 
Posts: 4570
Joined: Fri Nov 05, 2010 9:08 am
Location: Bucharest, Romania

Re: ffmpeg transcoding on the wdtv - success and failure   

Postby mutulaki » Thu Nov 29, 2012 2:35 am

Hi,

have you tried to remove the -acodec -vcodec options? i.e.

ffmpeg -i rtsp://192.168.1.10/camera-h264-stream.sdp -f avi h264-pcm-avi.avi
or
ffmpeg -i rtsp://192.168.1.10/camera-h264-stream.sdp -f mpegts h264-pcm-ts.ts

PCM should be supported by wdtv

regards,

M
mutulaki
DLX'er
 
Posts: 134
Joined: Thu Feb 02, 2012 1:38 am

PreviousNext

Return to UMSP Media Server

Who is online

Users browsing this forum: No registered users and 1 guest