2014年12月6日土曜日

RaspberryPiでMpeg2→Mpeg4へトランスコードする・続3

3回に渡って試行錯誤しながらやってきたが、
やり方がほぼ確立されたので今回で総集編となる。

Step1.準備
 $ git clone https://github.com/dickontoo/omxtx.git
 $ cd omxtx
 $ make
 $ sudo cp /usr/local/bin/ omxtx

Step2.トランスコード src.ts -> out.mp4(Mpeg2:1440x1080→Mpeg4:960x540)
 $ ffmpeg -y -i src.ts -acodec copy dst.aac -vcodec copy -an aaa.m2v
 $ omxtx -x -v -d -r 960x540 aaa.m2v dst.mp4
 $ ffmpeg -y -i dst.aac -i dst.mp4 -vcodec copy -acodec copy out.mp4

これで完成。
処理時間はほぼ録画時間と同じで終わるので非力なCPUなのにがんばってると思う。
でもハードウェアエンコード・デコード特有というのか、OpenMax側で異常データと判断すると
フレーム落ちして画像が乱れてしまう問題がある。
画像を縮小しなければフレーム落ちしないから、続2で見たアスペクト比の設定パラメータが影響してるのかもしれない。。
あとは16の倍数で割り切れる画面サイズでないといけない可能性のあるので、
画面サイズは、
 256x144 ◎エラーなし
 512x288 ×フリーズする 768x432
 1024x576
 1280x720

のいずれかになるようにする。



 出力例(最後の方にフレームエラーが多発している。。)
$ omxtx -x -v -d -r 960x540 tes.track_273.m2v aaa.mp4
[mpeg1video @ 0x1e1bfc0] mpeg_decode_postinit() failure
[mpeg1video @ 0x1e1bfc0] mpeg_decode_postinit() failure
[mpeg1video @ 0x1e1bfc0] mpeg_decode_postinit() failure
[mpeg1video @ 0x1e1bfc0] mpeg_decode_postinit() failure
[mpeg1video @ 0x1e1bfc0] mpeg_decode_postinit() failure
[mpeg1video @ 0x1e1bfc0] mpeg_decode_postinit() failure
[mpeg1video @ 0x1e1bfc0] mpeg_decode_postinit() failure
[mpeg1video @ 0x1e1bfc0] mpeg_decode_postinit() failure
[mpeg1video @ 0x1e1bfc0] mpeg_decode_postinit() failure
[mpeg1video @ 0x1e1bfc0] mpeg_decode_postinit() failure
[mpeg1video @ 0x1e1bfc0] mpeg_decode_postinit() failure
[mpeg1video @ 0x1e1bfc0] mpeg_decode_postinit() failure
[mpeg1video @ 0x1e1bfc0] mpeg_decode_postinit() failure
[mpeg1video @ 0x1e1bfc0] mpeg_decode_postinit() failure

[mpegvideo @ 0x1e1a0e0] Estimating duration from bitrate, this may be inaccurate
Input #0, mpegvideo, from 'tes.track_273.m2v':
  Duration: 00:00:06.16, bitrate: 24057 kb/s
    Stream #0.0: Video: mpeg2video (Main), yuv420p, 1440x1080 [PAR 4:3 DAR 16:9], 24000 kb/s, 25 fps, 25 tbr, 25 tbn, 59.94 tbc
Found a video at index 0
Frame size: 1440x1080
Found stream 0, context 0x1e1bfc0
OMX_Init() completed at 1399.
OMX_GetHandle(&dec, DECNAME, &ctx, &decevents) completed at 1400.
OMX_GetHandle(&enc, ENCNAME, &ctx, &encevents) completed at 1401.
OMX_GetHandle(&rsz, RSZNAME, &ctx, &rszevents) completed at 1402.
OMX_GetHandle(&dei, DEINAME, &ctx, &genevents) completed at 1403.
Obtained handles.  0x1e22638 decode, 0x1e1b920 encode
OMX_GetParameter(dec, OMX_IndexParamVideoInit, porttype) completed at 1412.
Found 2 ports, starting at 130 (82) on decoder
OMX_GetParameter(enc, OMX_IndexParamVideoInit, porttype) completed at 1417.
Found 2 ports, starting at 200 (c8) on encoder
OMX_GetParameter(rsz, OMX_IndexParamImageInit, porttype) completed at 1422.
Found 2 ports, starting at 60(3c) on resizer
OMX_SendCommand(dec, OMX_CommandPortDisable, PORT_DEC, NULL) completed at 1427.
OMX_SendCommand(dec, OMX_CommandPortDisable, PORT_DEC+1, NULL) completed at 1428.
OMX_SendCommand(enc, OMX_CommandPortDisable, PORT_ENC, NULL) completed at 1429.
OMX_SendCommand(enc, OMX_CommandPortDisable, PORT_ENC+1, NULL) completed at 1430.
OMX_SendCommand(rsz, OMX_CommandPortDisable, PORT_RSZ, NULL) completed at 1433.
OMX_SendCommand(rsz, OMX_CommandPortDisable, PORT_RSZ+1, NULL) completed at 1435.
OMX_GetParameter(dec, OMX_IndexParamPortDefinition, portdef) completed at 1439.
Mapping codec ID 2 (2)
Mapping codec 2 to 2
Mapping codec ID 2 (2)
OMX_SetParameter(dec, OMX_IndexParamPortDefinition, portdef) completed at 1450.
Codecs supported:
        Index:          0
        Codec:          0 (0)
        Colour:         0
        Framerate:      0 (0.000000)
Levels supported:
        Index:          0
        Profile:        1
        Level:          256
Levels supported:
        Index:          1
        Profile:        32768
        Level:          256
OMX_GetParameter(handle, OMX_IndexParamPortDefinition, portdef) completed at 215.
Port 130 is input, disabled
Wants 20 bufs, needs 1, size 81920, enabled: 0, pop: 0, aligned 16
Video type is currently:
        MIME:           (null)
        Native:         (nil)
        Width:          1440
        Height:         1080
        Stride:         0
        SliceHeight:    0
        Bitrate:        0
        Framerate:      0 (0); (0.000000)
        Error hiding:   0
        Codec:          2
        Colour:         0
OMX_GetParameter(handle, OMX_IndexParamPortDefinition, portdef) completed at 215.
Port 131 is output, disabled
Wants 1 bufs, needs 1, size 2350080, enabled: 0, pop: 0, aligned 16
Video type is currently:
        MIME:           (null)
        Native:         (nil)
        Width:          1440
        Height:         1080
        Stride:         1440
        SliceHeight:    1088
        Bitrate:        0
        Framerate:      0 (0); (0.000000)
        Error hiding:   0
        Codec:          0
        Colour:         20
OMX_GetParameter(handle, OMX_IndexParamPortDefinition, portdef) completed at 215.
Port 60 is input, disabled
Wants 1 bufs, needs 1, size 10240, enabled: 0, pop: 0, aligned 16
Image type is currently:
        MIME:           (null)
        Native:         (nil)
        Width:          160
        Height:         16
        Stride:         640
        SliceHeight:    16
        Error hiding:   0
        Codec:          0
        Colour:         2130706433
OMX_GetParameter(handle, OMX_IndexParamPortDefinition, portdef) completed at 215.
Port 61 is output, disabled
Wants 1 bufs, needs 1, size 10240, enabled: 0, pop: 0, aligned 16
Image type is currently:
        MIME:           (null)
        Native:         (nil)
        Width:          160
        Height:         16
        Stride:         640
        SliceHeight:    16
        Error hiding:   0
        Codec:          0
        Colour:         2130706433
OMX_GetParameter(handle, OMX_IndexParamPortDefinition, portdef) completed at 215.
Port 200 is input, disabled
Wants 1 bufs, needs 1, size 15360, enabled: 0, pop: 0, aligned 16
Video type is currently:
        MIME:           (null)
        Native:         (nil)
        Width:          160
        Height:         64
        Stride:         160
        SliceHeight:    64
        Bitrate:        0
        Framerate:      1966080 (1e0000); (30.000000)
        Error hiding:   0
        Codec:          0
        Colour:         20
OMX_GetParameter(handle, OMX_IndexParamPortDefinition, portdef) completed at 215.
Port 201 is output, disabled
Wants 1 bufs, needs 1, size 65536, enabled: 0, pop: 0, aligned 16
Video type is currently:
        MIME:           (null)
        Native:         (nil)
        Width:          160
        Height:         64
        Stride:         160
        SliceHeight:    64
        Bitrate:        0
        Framerate:      1966080 (1e0000); (30.000000)
        Error hiding:   0
        Codec:          4
        Colour:         0
OMX_SendCommand(dec, OMX_CommandStateSet, OMX_StateIdle, NULL) completed at 1514.
OMX_SendCommand(rsz, OMX_CommandStateSet, OMX_StateIdle, NULL) completed at 1517.
OMX_GetParameter(h, OMX_IndexParamPortDefinition, portdef) completed at 724.
OMX_SendCommand(h, OMX_CommandPortEnable, port, NULL) completed at 727.
Allocated a buffer of 81920 bytes
OMX_UseBuffer(h, end, port, NULL, portdef->nBufferSize, buf) completed at 737.
Allocated a buffer of 81920 bytes
OMX_UseBuffer(h, end, port, NULL, portdef->nBufferSize, buf) completed at 737.
Allocated a buffer of 81920 bytes
OMX_UseBuffer(h, end, port, NULL, portdef->nBufferSize, buf) completed at 737.
Allocated a buffer of 81920 bytes
OMX_UseBuffer(h, end, port, NULL, portdef->nBufferSize, buf) completed at 737.
Allocated a buffer of 81920 bytes
OMX_UseBuffer(h, end, port, NULL, portdef->nBufferSize, buf) completed at 737.
Allocated a buffer of 81920 bytes
OMX_UseBuffer(h, end, port, NULL, portdef->nBufferSize, buf) completed at 737.
Allocated a buffer of 81920 bytes
OMX_UseBuffer(h, end, port, NULL, portdef->nBufferSize, buf) completed at 737.
Allocated a buffer of 81920 bytes
OMX_UseBuffer(h, end, port, NULL, portdef->nBufferSize, buf) completed at 737.
Allocated a buffer of 81920 bytes
OMX_UseBuffer(h, end, port, NULL, portdef->nBufferSize, buf) completed at 737.
Allocated a buffer of 81920 bytes
OMX_UseBuffer(h, end, port, NULL, portdef->nBufferSize, buf) completed at 737.
Allocated a buffer of 81920 bytes
OMX_UseBuffer(h, end, port, NULL, portdef->nBufferSize, buf) completed at 737.
Allocated a buffer of 81920 bytes
OMX_UseBuffer(h, end, port, NULL, portdef->nBufferSize, buf) completed at 737.
Allocated a buffer of 81920 bytes
OMX_UseBuffer(h, end, port, NULL, portdef->nBufferSize, buf) completed at 737.
Allocated a buffer of 81920 bytes
OMX_UseBuffer(h, end, port, NULL, portdef->nBufferSize, buf) completed at 737.
Allocated a buffer of 81920 bytes
OMX_UseBuffer(h, end, port, NULL, portdef->nBufferSize, buf) completed at 737.
Allocated a buffer of 81920 bytes
OMX_UseBuffer(h, end, port, NULL, portdef->nBufferSize, buf) completed at 737.
Allocated a buffer of 81920 bytes
OMX_UseBuffer(h, end, port, NULL, portdef->nBufferSize, buf) completed at 737.
Allocated a buffer of 81920 bytes
OMX_UseBuffer(h, end, port, NULL, portdef->nBufferSize, buf) completed at 737.
Allocated a buffer of 81920 bytes
OMX_UseBuffer(h, end, port, NULL, portdef->nBufferSize, buf) completed at 737.
Allocated a buffer of 81920 bytes
OMX_UseBuffer(h, end, port, NULL, portdef->nBufferSize, buf) completed at 737.
OMX_SendCommand(dec, OMX_CommandStateSet, OMX_StateExecuting, NULL) completed at 1525.
Decoder 0x1e22638 port 131 settings changed.
OMX_GetParameter(handle, OMX_IndexParamPortDefinition, portdef) completed at 215.
Port 131 is output, disabled
Wants 1 bufs, needs 1, size 2350080, enabled: 0, pop: 0, aligned 16
Video type is currently:
        MIME:           (null)
        Native:         (nil)
        Width:          1440
        Height:         1080
        Stride:         1440
        SliceHeight:    1088
        Bitrate:        0
        Framerate:      1964115 (1df853); (29.970016)
        Error hiding:   0
        Codec:          0
        Colour:         20
Decoder has changed settings.  Setting up encoder.
OMX_GetParameter(dec, OMX_IndexParamPortDefinition, portdef) completed at 861.
OMX_SendCommand(dei, OMX_CommandStateSet, OMX_StateIdle, NULL) completed at 866.
OMX_SendCommand(dei, OMX_CommandPortDisable, PORT_DEI, NULL) completed at 869.
OMX_SendCommand(dei, OMX_CommandPortDisable, PORT_DEI+1, NULL) completed at 871.
OMX_SetParameter(dei, OMX_IndexParamPortDefinition, portdef) completed at 873.
OMX_SetParameter(dei, OMX_IndexParamPortDefinition, portdef) completed at 876.
OMX_SetParameter(prev, OMX_IndexParamBrcmExtraBuffers, extra_buffers) completed at 882.
OMX_SetConfig(dei, OMX_IndexConfigCommonImageFilterParameters, image_filter) completed at 889.
OMX_GetParameter(dei, OMX_IndexParamPortDefinition, imgportdef) completed at 893.
OMX_GetParameter(handle, OMX_IndexParamPortDefinition, portdef) completed at 215.
Port 190 is input, disabled
Wants 1 bufs, needs 1, size 2350080, enabled: 0, pop: 0, aligned 16
Image type is currently:
        MIME:           (null)
        Native:         (nil)
        Width:          1440
        Height:         1080
        Stride:         1440
        SliceHeight:    1088
        Error hiding:   0
        Codec:          0
        Colour:         20
OMX_GetParameter(handle, OMX_IndexParamPortDefinition, portdef) completed at 215.
Port 191 is output, disabled
Wants 1 bufs, needs 1, size 2350080, enabled: 0, pop: 0, aligned 16
Image type is currently:
        MIME:           (null)
        Native:         (nil)
        Width:          1440
        Height:         1080
        Stride:         1440
        SliceHeight:    1088
        Error hiding:   0
        Codec:          0
        Colour:         20
OMX_SetupTunnel(prev, pp, dei, PORT_DEI) completed at 908.
OMX_GetParameter(rsz, OMX_IndexParamPortDefinition, imgportdef) completed at 916.
OMX_SetParameter(rsz, OMX_IndexParamPortDefinition, imgportdef) completed at 930.
Frame size: 960x544, scale factor 960
OMX_SetParameter(rsz, OMX_IndexParamPortDefinition, imgportdef) completed at 954.
OMX_GetParameter(rsz, OMX_IndexParamPortDefinition, imgportdef) completed at 957.
OMX_SetParameter(enc, OMX_IndexParamPortDefinition, portdef) completed at 971.
OMX_SetupTunnel(prev, pp, rsz, PORT_RSZ) completed at 997.
OMX_SendCommand(enc, OMX_CommandStateSet, OMX_StateIdle, NULL) completed at 1001.
OMX_GetParameter(handle, OMX_IndexParamPortDefinition, portdef) completed at 215.
Port 61 is output, disabled
Wants 1 bufs, needs 1, size 783360, enabled: 0, pop: 0, aligned 16
Image type is currently:
        MIME:           (null)
        Native:         (nil)
        Width:          960
        Height:         544
        Stride:         960
        SliceHeight:    544
        Error hiding:   0
        Codec:          0
        Colour:         20
OMX_GetParameter(handle, OMX_IndexParamPortDefinition, portdef) completed at 215.
Port 200 is input, disabled
Wants 1 bufs, needs 1, size 2350080, enabled: 0, pop: 0, aligned 16
Video type is currently:
        MIME:           (null)
        Native:         (nil)
        Width:          960
        Height:         544
        Stride:         960
        SliceHeight:    544
        Bitrate:        0
        Framerate:      1964115 (1df853); (29.970016)
        Error hiding:   0
        Codec:          0
        Colour:         20
OMX_SetupTunnel(prev, pp, enc, PORT_ENC) completed at 1004.
OMX_SetParameter(enc, OMX_IndexParamPortDefinition, portdef) completed at 1020.
OMX_SetParameter(enc, OMX_IndexParamVideoBitrate, bitrate) completed at 1026.
OMX_SetParameter(enc, OMX_IndexParamVideoPortFormat, pfmt) completed at 1048.
OMX_SetParameter(enc, OMX_IndexConfigVideoFramerate, framerate) completed at 1053.
OMX_GetParameter(enc, OMX_IndexParamVideoProfileLevelCurrent, level) completed at 1069.
Current level:          2048
Current profile:        8
OMX_SetParameter(enc, OMX_IndexParamVideoProfileLevelCurrent, level) completed at 1073.
OMX_GetParameter(h, OMX_IndexParamPortDefinition, portdef) completed at 724.
OMX_SendCommand(h, OMX_CommandPortEnable, port, NULL) completed at 727.
Allocated a buffer of 2350080 bytes
OMX_UseBuffer(h, end, port, NULL, portdef->nBufferSize, buf) completed at 737.
OMX_SendCommand(dec, OMX_CommandPortEnable, PORT_DEC+1, NULL) completed at 1076.
Resizer 0x1e1b9f0 port 61 settings changed.
OMX_GetParameter(handle, OMX_IndexParamPortDefinition, portdef) completed at 215.
Port 61 is output, disabled
Wants 1 bufs, needs 1, size 783360, enabled: 0, pop: 0, aligned 16
Image type is currently:
        MIME:           (null)
        Native:         (nil)
        Width:          960
        Height:         544
        Stride:         960
        SliceHeight:    544
        Error hiding:   0
        Codec:          0
        Colour:         20
OMX_SendCommand(rsz, OMX_CommandPortEnable, PORT_RSZ, NULL) completed at 1079.
OMX_SendCommand(rsz, OMX_CommandPortEnable, PORT_RSZ+1, NULL) completed at 1081.
OMX_SendCommand(enc, OMX_CommandPortEnable, PORT_ENC, NULL) completed at 1084.
Unknown! 0x1e1bac0 port 191 settings changed.
OMX_GetParameter(handle, OMX_IndexParamPortDefinition, portdef) completed at 215.
Port 191 is output, disabled
Wants 0 bufs, needs 0, size 2350080, enabled: 0, pop: 1, aligned 16
Image type is currently:
        MIME:           (null)
        Native:         (nil)
        Width:          1440
        Height:         1080
        Stride:         1440
        SliceHeight:    1088
        Error hiding:   0
        Codec:          0
        Colour:         20
OMX_SendCommand(dei, OMX_CommandPortEnable, PORT_DEI, NULL) completed at 1107.
OMX_SendCommand(dei, OMX_CommandPortEnable, PORT_DEI+1, NULL) completed at 1109.
OMX_GetParameter(handle, OMX_IndexParamPortDefinition, portdef) completed at 215.
Port 190 is input, enabled
Wants 0 bufs, needs 0, size 2350080, enabled: 1, pop: 1, aligned 16
Image type is currently:
        MIME:           (null)
        Native:         (nil)
        Width:          1440
        Height:         1080
        Stride:         1440
        SliceHeight:    1088
        Error hiding:   0
        Codec:          0
        Colour:         20
OMX_GetParameter(handle, OMX_IndexParamPortDefinition, portdef) completed at 215.
Port 191 is output, enabled
Wants 0 bufs, needs 0, size 2350080, enabled: 1, pop: 1, aligned 16
Image type is currently:
        MIME:           (null)
        Native:         (nil)
        Width:          1440
        Height:         1080
        Stride:         1440
        SliceHeight:    1088
        Error hiding:   0
        Codec:          0
        Colour:         20
OMX_SendCommand(dei, OMX_CommandStateSet, OMX_StateExecuting, NULL) completed at 1115.
OMX_SendCommand(rsz, OMX_CommandStateSet, OMX_StateExecuting, NULL) completed at 1120.
OMX_SendCommand(enc, OMX_CommandStateSet, OMX_StateExecuting, NULL) completed at 1122.
Encoder 0x1e1b920 port 201 settings changed.
OMX_GetParameter(handle, OMX_IndexParamPortDefinition, portdef) completed at 215.
Port 201 is output, enabled
Wants 1 bufs, needs 1, size 2350080, enabled: 1, pop: 1, aligned 16
Video type is currently:
        MIME:           (null)
        Native:         (nil)
        Width:          960
        Height:         544
        Stride:         0
        SliceHeight:    0
        Bitrate:        2097152
        Framerate:      1964115 (1df853); (29.970016)
        Error hiding:   0
        Codec:          7
        Colour:         0
OMX_FillThisBuffer(enc, encbufs) completed at 1124.
OMX_GetParameter(handle, OMX_IndexParamPortDefinition, portdef) completed at 215.
Port 130 is input, enabled
Wants 20 bufs, needs 1, size 81920, enabled: 1, pop: 1, aligned 16
Video type is currently:
        MIME:           (null)
        Native:         (nil)
        Width:          1440
        Height:         1080
        Stride:         0
        SliceHeight:    0
        Bitrate:        0
        Framerate:      0 (0); (0.000000)
        Error hiding:   0
        Codec:          2
        Colour:         0
OMX_GetParameter(handle, OMX_IndexParamPortDefinition, portdef) completed at 215.
Port 131 is output, enabled
Wants 0 bufs, needs 0, size 2350080, enabled: 1, pop: 1, aligned 16
Video type is currently:
        MIME:           (null)
        Native:         (nil)
        Width:          1440
        Height:         1080
        Stride:         1440
        SliceHeight:    1088
        Bitrate:        0
        Framerate:      1964115 (1df853); (29.970016)
        Error hiding:   0
        Codec:          0
        Colour:         20
OMX_GetParameter(handle, OMX_IndexParamPortDefinition, portdef) completed at 215.
Port 60 is input, enabled
Wants 0 bufs, needs 0, size 2350080, enabled: 1, pop: 1, aligned 16
Image type is currently:
        MIME:           (null)
        Native:         (nil)
        Width:          1440
        Height:         1080
        Stride:         1440
        SliceHeight:    1088
        Error hiding:   0
        Codec:          0
        Colour:         20
OMX_GetParameter(handle, OMX_IndexParamPortDefinition, portdef) completed at 215.
Port 61 is output, enabled
Wants 1 bufs, needs 1, size 783360, enabled: 1, pop: 1, aligned 16
Image type is currently:
        MIME:           (null)
        Native:         (nil)
        Width:          960
        Height:         544
        Stride:         960
        SliceHeight:    544
        Error hiding:   0
        Codec:          0
        Colour:         20
OMX_GetParameter(handle, OMX_IndexParamPortDefinition, portdef) completed at 215.
Port 200 is input, enabled
Wants 1 bufs, needs 1, size 783360, enabled: 1, pop: 1, aligned 16
Video type is currently:
        MIME:           (null)
        Native:         (nil)
        Width:          960
        Height:         544
        Stride:         960
        SliceHeight:    544
        Bitrate:        0
        Framerate:      0 (0); (0.000000)
        Error hiding:   0
        Codec:          0
        Colour:         20
OMX_GetParameter(handle, OMX_IndexParamPortDefinition, portdef) completed at 215.
Port 201 is output, enabled
Wants 1 bufs, needs 1, size 2350080, enabled: 1, pop: 1, aligned 16
Video type is currently:
        MIME:           (null)
        Native:         (nil)
        Width:          960
        Height:         544
        Stride:         0
        SliceHeight:    0
        Bitrate:        2097152
        Framerate:      1964115 (1df853); (29.970016)
        Error hiding:   0
        Codec:          7
        Colour:         0
Found a codec at 0xb68b5ffc
Defaults: output stream: 1/90000, input stream: 1/25, input codec: 1001/60000, output codec: 0/1, output framerate: 0/0, input framerate: 25/1, ticks: 1; 2 -9223372036854775808/0
Defaults: output stream: 1/90000, input stream: 1/25, input codec: 1001/60000, output codec: 1001/60000, output framerate: 25/1, input framerate: 25/1
Time base: 1/90000, fps 25/1



Input:
Input #0, mpegvideo, from 'tes.track_273.m2v':
  Duration: 00:00:06.16, bitrate: 24057 kb/s
    Stream #0.0: Video: mpeg2video (Main), yuv420p, 1440x1080 [PAR 4:3 DAR 16:9], 24000 kb/s, 25 fps, 25 tbr, 25 tbn, 59.94 tbc



Output:
Output #0, mp4, to 'aaa.mp4':
    Stream #0.0: Video: libx264, 960x544, q=-1--1, 2097 kb/s, 25 fps, 25 tbr, 90k tbn, 59.94 tbc
New SPS, length 18
New PPS, length 9
Writing initial frame buffer contents out... ...done.  Wrote 0 frames.

[mp4 @ 0x1e21a80] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 76800 >= 76800
Failed to write a video frame: Invalid argument (78802, 133d2; 1313367 0) 410.
[mp4 @ 0x1e21a80] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 78802 >= 78802
Failed to write a video frame: Invalid argument (79803, 137bb; 1330050 0) 410.
[mp4 @ 0x1e21a80] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 86002 >= 86002
Failed to write a video frame: Invalid argument (87003, 153db; 1450050 0) 410.
[mp4 @ 0x1e21a80] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 90006 >= 90006
Failed to write a video frame: Invalid argument (91007, 1637f; 1516784 0) 410.
[mp4 @ 0x1e21a80] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 100016 >= 100016
Failed to write a video frame: Invalid argument (101017, 18a99; 1683619 0) 410.
[mp4 @ 0x1e21a80] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 119035 >= 119035
Failed to write a video frame: Invalid argument (120036, 1d4e4; 2000606 0) 410.
[mp4 @ 0x1e21a80] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 183401 >= 183401
Failed to write a video frame: Invalid argument (184800, 2d1e0; 3080000 0) 410.
[mp4 @ 0x1e21a80] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 219401 >= 219401
Failed to write a video frame: Invalid argument (220800, 35e80; 3680000 0) 410.
[mp4 @ 0x1e21a80] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 267003 >= 267003
Failed to write a video frame: Invalid argument (268800, 41a00; 4480000 0) 410.
[mp4 @ 0x1e21a80] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 337423 >= 337423
Failed to write a video frame: Invalid argument (338424, 529f8; 5640404 0) 410.
[mp4 @ 0x1e21a80] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 418505 >= 418505
Failed to write a video frame: Invalid argument (419506, 666b2; 6991767 0) 410.
[mp4 @ 0x1e21a80] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 664800 >= 664800
Failed to write a video frame: Invalid argument (667200, a2e40; 11120000 0) 410.
[mp4 @ 0x1e21a80] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 667200 >= 667200
Failed to write a video frame: Invalid argument (668201, a3229; 11136683 0) 410.
[mp4 @ 0x1e21a80] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 676402 >= 676402
Failed to write a video frame: Invalid argument (677403, a561b; 11290050 0) 410.
Processed 327 frames in 12 seconds; 27f/s




In exit handler, after 327 frames:
OMX_GetParameter(handle, OMX_IndexParamPortDefinition, portdef) completed at 215.
Port 130 is input, enabled
Wants 20 bufs, needs 1, size 81920, enabled: 1, pop: 1, aligned 16
Video type is currently:
        MIME:           (null)
        Native:         (nil)
        Width:          1440
        Height:         1080
        Stride:         0
        SliceHeight:    0
        Bitrate:        0
        Framerate:      0 (0); (0.000000)
        Error hiding:   0
        Codec:          2
        Colour:         0
OMX_GetParameter(handle, OMX_IndexParamPortDefinition, portdef) completed at 215.
Port 131 is output, enabled
Wants 0 bufs, needs 0, size 2350080, enabled: 1, pop: 1, aligned 16
Video type is currently:
        MIME:           (null)
        Native:         (nil)
        Width:          1440
        Height:         1080
        Stride:         1440
        SliceHeight:    1088
        Bitrate:        0
        Framerate:      1964115 (1df853); (29.970016)
        Error hiding:   0
        Codec:          0
        Colour:         20
OMX_GetParameter(handle, OMX_IndexParamPortDefinition, portdef) completed at 215.
Port 200 is input, enabled
Wants 1 bufs, needs 1, size 783360, enabled: 1, pop: 1, aligned 16
Video type is currently:
        MIME:           (null)
        Native:         (nil)
        Width:          960
        Height:         544
        Stride:         960
        SliceHeight:    544
        Bitrate:        0
        Framerate:      0 (0); (0.000000)
        Error hiding:   0
        Codec:          0
        Colour:         20
OMX_GetParameter(handle, OMX_IndexParamPortDefinition, portdef) completed at 215.
Port 201 is output, enabled
Wants 1 bufs, needs 1, size 2350080, enabled: 1, pop: 1, aligned 16
Video type is currently:
        MIME:           (null)
        Native:         (nil)
        Width:          960
        Height:         544
        Stride:         0
        SliceHeight:    0
        Bitrate:        2097152
        Framerate:      1964115 (1df853); (29.970016)
        Error hiding:   0
        Codec:          7
        Colour:         0
Decoder state: 3
Encoder state: 3

何か進展があれば、書き足していく予定です。

2014年12月5日金曜日

RaspberryPiでMpeg2→Mpeg4へトランスコードする・続2


前回の続き、
http://ivis-mynikki.blogspot.jp/2014/11/rasberry-pimpeg2mpeg4.html

omxtxをmakeするとき、ライブラリが足りないものはaptitudeで調べて ***-devをインストール。
リンカエラーが出たら LIBS=-lavcodec など追加していくとビルドが通る。

テストデータをMP4化してみてchromebookで再生できるかと思ったら再生できなかったが、
出来上がったMP4動画ファイルに音声ファイルを結合すると再生できた。
でも画質が悪い。一昔のVHS映像並。なんでだろう。


ビットレートの設定が反映されてないような気がするので
ソースを見てみる。

まずはMain関数から。
引数を展開して、Init処理から始まる。
 
動画ファイルをオープンして、
 vidindex = av_find_best_stream(ic, AVMEDIA_TYPE_VIDEO, -1, -1,
                NULL, 0);


Mpeg2デコード、Mpeg4エンコード、リサイズ設定して、、
        bcm_host_init();
        OERR(OMX_Init(), ctx.verbose);
        OERR(OMX_GetHandle(&m2, DECNAME, &ctx, &decevents), ctx.verbose);
        OERR(OMX_GetHandle(&m4, ENCNAME, &ctx, &encevents), ctx.verbose);
        OERR(OMX_GetHandle(&resize, RESIZENAME, &ctx, &resizeevents), ctx.verbose);


OpenMAXにパラメータ送信して、
         OERR(OMX_GetParameter(m2, OMX_IndexParamVideoInit, porttype), ctx.verbose);
        if (ctx.verbose) printf("Found %d ports, starting at %d (%x) on decoder\n",
                porttype->nPorts, porttype->nStartPortNumber,
                porttype->nStartPortNumber);
        ctx.decportidx = decportidx = porttype->nStartPortNumber;

        OERR(OMX_GetParameter(resize, OMX_IndexParamImageInit, porttype), ctx.verbose);
        if (ctx.verbose) printf("Found %d ports, starting at %d (%x) on resizer\n",
                porttype->nPorts, porttype->nStartPortNumber,
                porttype->nStartPortNumber);
        ctx.resizeportidx = resizeportidx = porttype->nStartPortNumber;

        OERR(OMX_GetParameter(m4, OMX_IndexParamVideoInit, porttype), ctx.verbose);
        if (ctx.verbose) printf("Found %d ports, starting at %d (%x) on encoder\n",
                porttype->nPorts, porttype->nStartPortNumber,
                porttype->nStartPortNumber);
        ctx.encportidx = encportidx = porttype->nStartPortNumber;
        free(porttype);

        OERR(OMX_SendCommand(m2, OMX_CommandPortDisable, decportidx, NULL), ctx.verbose);
        OERR(OMX_SendCommand(m2, OMX_CommandPortDisable, decportidx+1, NULL), ctx.verbose);
        OERR(OMX_SendCommand(resize, OMX_CommandPortDisable, resizeportidx, NULL), ctx.verbose);
        OERR(OMX_SendCommand(resize, OMX_CommandPortDisable, resizeportidx+1, NULL), ctx.verbose);
        OERR(OMX_SendCommand(m4, OMX_CommandPortDisable, encportidx, NULL), ctx.verbose);
        OERR(OMX_SendCommand(m4, OMX_CommandPortDisable, encportidx+1, NULL), ctx.verbose);


処理開始。
    OERR(OMX_SendCommand(m2, OMX_CommandStateSet, OMX_StateExecuting, NULL), ctx.verbose);

ビットレートの設定が無いなって思ったら、実行処理の中にある
DECTUNNELSETUP内のconfigure関数で行っているようだった。

これであってるのか分からないが。。
1つ気づいたのはデインターレース処理が入ってないなって思ったので、
対応したomxtxが調べてみたらありました。

Dickon hood氏が2013年に対応してくださっていたようだ。
 * (c) 2012, 2013 Dickon Hood
 * Timing fixups by Adam Charrett
 *
 * A trivial OpenMAX transcoder for the Pi.
 *
 * Very much a work-in-progress, and as such is noisy, doesn't produce
 * particularly pretty output, and is probably buggier than a swamp in
 * summer.  Beware of memory leaks.
 *
 * Usage: ./omxtx [-b bitrate] [-r size] [-x] [-d] [-m] input.foo output.mp4


でも今ビルドしたものはArjen氏が改造したもの。
 * (c) 2012 Dickon Hood
 * modified dec 2012 by Arjen V
 * Added resizer functionality
 * Added pixelaspectratio (hardware)
 *
 * A trivial OpenMAX transcoder for the Pi.
 *
 * Very much a work-in-progress, and as such is noisy, doesn't produce
 * particularly pretty output, and is probably buggier than a swamp in
 * summer.  Beware of memory leaks.
 *
 * Usage: ./omxtx [-v] [-b bitrate] [-s WxH] input.foo output.m4v


追加内容を見ると、
<Deckon氏>
    pixaspect->nPortIndex = PORT_ENC+1;
    pixaspect->nX = 64;
    pixaspect->nY = 45;
//    OERR(OMX_SetParameter(dec, OMX_IndexParamBrcmPixelAspectRatio, pixaspect));


 <Arien氏>
       pixaspect->nPortIndex = encportidx+1;
        pixaspect->nX = 118;
        pixaspect->nY = 81;
        OERR(OMX_SetConfig(m4, OMX_IndexParamBrcmPixelAspectRatio, pixaspect), ctx->verbose);
        free(pixaspect);


 少し設定値が違うようだけど、Deckon氏の早く気づいておけばよかった。。

今日はここまで。


次回は最新版のomxtxでビットレートの設定が正しくなっているか、

またはデコード・エンコードの仕方を見直し?を行う。




2014年11月29日土曜日

マウスのホイールを使った後にCTRLキーを押すと縮小、拡大する。

Win8が出た辺りからLogicool製マウスのホイールを動かしてないのにCTRLキーを押すとWEBページが縮小・拡大されるという現象があって、OSの不具合か何かかと思ってずっとガマンしてきたんだけど、いよいよフラストレーション爆発。
ロジクールのマウス3つ買って3つとも同じ現象がでたからロジクールやめようと思いながら色々設定をいじってみたら、

SetPointのマウスの項目にある 
 ポインタの加速を「なし」
 スマートムー部を有効にする「チェックなし」

にしたら解決。

どうもONにした状態だとページスクロールを滑らかになるように細かく連続して動いてるようで、
その時にCTRLキーを押すと縮小・拡大されてしまうだった。
まあ、CTRLキーを多様するユーザーは少ないとみてこのような仕様にしたんだろうな。。

2014年11月28日金曜日

Rasberry Piで Mpeg2→Mpeg4へトランスコードする・続


gstreamerを使ってみて思ったのこと。設定がむずかしい。。
画像が乱れる問題とかもあるし、いっその事omxmpeg2videodec、omxh264encを抜き出してMpeg2→Mpeg4へトランスコードするツールを作ろうかと思ってたら
omxtxというツールが2年前に作られていたようだ。

https://github.com/arjenv/omxtx/

ソースコードは1つだけだから、時間がある時に解析しようと思う。

それ用の解析資料は残しておく。


デインタレースは出来ないようなので、4分の1スケールに縮小しちゃおうかと思うけど、
地デジの解像度は1440x1080iだから

 100% 1440x1080 実寸画質 約5.6GB/時間
 50% 720x540   DVD画質 約1.4GB/時間
 25% 360x270   CD画質  約350MB/時間


つまりCD画質になってしまう。
これならワンセグをそのまま保存してるのと変わりなくなってしまうので、
インターレースは残したまま縮小せずにトランスコードする方法を考える。


次回はOMXTXをそのまま使ってみる編。



参考ページ
http://ricky-tee.blogspot.jp/2012/10/raspberry-pi-as-hardware-assisted-h264.html
https://harrybuttle.wordpress.com/2013/08/05/hardware-transcoding-on-the-raspberry-pi/
http://www.raspberrypi.org/forums/viewtopic.php?f=70&t=25022


2014年11月26日水曜日

Raspberry Pi用にGStreamer 1.4をコンパイルする

Gstreamer1.0だとブロックノイズや格子が気になるので、最新版を自前で用意することにしたときのメモ。
DebianのUnstableからソース持ってきてビルドでも良かったけど、乗っているやり方そのままやることにした。


Step1.コンパイル環境の構築
http://pastebin.com/S1zGK9kP

  1. sudo apt-get update && sudo apt-get upgrade -y --force-yes
  2. sudo apt-get install -y --force-yes build-essential autotools-dev automake autoconf libtool autopoint libxml2-dev zlib1g-dev libglib2.0-dev pkg-config bison flex python git gtk-doc-tools libasound2-dev libgudev-1.0-dev libxt-dev libvorbis-dev libcdparanoia-dev libpango1.0-dev libtheora-dev libvisual-0.4-dev iso-codes libgtk-3-dev libraw1394-dev libiec61883-dev libavc1394-dev libv4l-dev libcairo2-dev libcaca-dev libspeex-dev libpng-dev libshout3-dev libjpeg-dev libaa1-dev libflac-dev libdv4-dev libtag1-dev libwavpack-dev libpulse-dev libsoup2.4-dev libbz2-dev libcdaudio-dev libdc1394-22-dev ladspa-sdk libass-dev libcurl4-gnutls-dev libdca-dev libdirac-dev libdvdnav-dev libexempi-dev libexif-dev libfaad-dev libgme-dev libgsm1-dev libiptcdata0-dev libkate-dev libmimic-dev libmms-dev libmodplug-dev libmpcdec-dev libofa0-dev libopus-dev librsvg2-dev librtmp-dev libslv2-dev libsndfile1-dev libsoundtouch-dev libspandsp-dev libx11-dev libxvidcore-dev libzbar-dev libzvbi-dev liba52-0.7.4-dev libcdio-dev libdvdread-dev libmad0-dev libmp3lame-dev libmpeg2-4-dev libopencore-amrnb-dev libopencore-amrwb-dev libsidplay1-dev libtwolame-dev libx264-dev
  3.                                    
  4. cd ~
  5. mkdir packages
  6. cd packages
  7. mkdir gstreamer-1.2
  8. cd gstreamer-1.2
  9. git clone git://anongit.freedesktop.org/git/gstreamer/gstreamer
  10. git clone git://anongit.freedesktop.org/git/gstreamer/gst-plugins-base
  11. git clone git://anongit.freedesktop.org/git/gstreamer/gst-plugins-good
  12. git clone git://anongit.freedesktop.org/git/gstreamer/gst-plugins-bad
  13. git clone git://anongit.freedesktop.org/git/gstreamer/gst-plugins-ugly
  14. git clone git://anongit.freedesktop.org/git/gstreamer/gst-libav
  15. git clone git://anongit.freedesktop.org/git/gstreamer/gst-omx
  16. git clone https://github.com/thaytan/gst-rpicamsrc.git
  17. cd gstreamer
  18. ./autogen.sh
  19. sudo make
  20. sudo make install
  21. cd ../gst-plugins-base
  22. ./autogen.sh
  23. sudo make
  24. sudo make install
  25. cd ../gst-plugins-good
  26. ./autogen.sh
  27. sudo make
  28. sudo make install
  29. cd gst-plugins-ugly
  30. ./autogen.sh
  31. sudo make
  32. sudo make install
  33. cd ../gst-libav
  34. sudo ./autogen.sh
  35. sudo make
  36. sudo make install
  37. sudo apt-get install -y --force-yes libusb-1.0
  38. cd ../gst-plugins-bad
  39. export LD_LIBRARY_PATH=/usr/local/lib/ path
  40. sudo LDFLAGS='-L/opt/vc/lib' CPPFLAGS='-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux' ./autogen.sh
  41. sudo make CFLAGS+="-Wno-error"
  42. sudo make install
  43. cd ../gst-omx
  44. LDFLAGS='-L/opt/vc/lib' CPPFLAGS='-I/opt/vc/include -I/opt/vc/include/IL -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux' ./autogen.sh --with-omx-target=rpi
  45. sudo make CFLAGS+="-Wno-error"
  46. sudo make install
  47. cd ../gst-rpicamsrc
  48. ./autogen --prefix=/usr --libdir=/usr/lib/arm-linux-gnueabihf/
  49. make
  50. sudo make install




参考リンク
http://lists.freedesktop.org/archives/gstreamer-openmax/2013-March/000724.html
http://direct.raspberrypi.org/forums/viewtopic.php?t=83225&p=588493
http://tnishinaga.hatenablog.com/entry/2014/05/11/224944

Raspberry pi でMpeg2→Mpeg4へトランスコードする

RaspberryPiでハードウェアエンコードも可能だという事がわかったので、さっそくやってみることにした。


Step1.必要なファイルをインストールする

$ sudo sh -c "echo 'deb http://vontaene.de/raspbian-updates/ . main' >> /etc/apt/sources.list"
$ gpg --recv-keys 0C667A3E
$ gpg -a --export 0C667A3E | sudo apt-key add -
$ sudo aptitude update

$ apt-get install libgstreamer1.0-0 libgstreamer1.0-0-dbg libgstreamer1.0-dev liborc-0.4-0 liborc-0.4-0-dbg liborc-0.4-dev liborc-0.4-doc gir1.2-gst-plugins-base-1.0 gir1.2-gstreamer-1.0 gstreamer1.0-alsa gstreamer1.0-doc gstreamer1.0-omx gstreamer1.0-plugins-bad gstreamer1.0-plugins-bad-dbg gstreamer1.0-plugins-bad-doc gstreamer1.0-plugins-base gstreamer1.0-plugins-base-apps gstreamer1.0-plugins-base-dbg gstreamer1.0-plugins-base-doc gstreamer1.0-plugins-good gstreamer1.0-plugins-good-dbg gstreamer1.0-plugins-good-doc gstreamer1.0-plugins-ugly gstreamer1.0-plugins-ugly-dbg gstreamer1.0-plugins-ugly-doc gstreamer1.0-pulseaudio gstreamer1.0-tools gstreamer1.0-x libgstreamer-plugins-bad1.0-0 libgstreamer-plugins-bad1.0-dev libgstreamer-plugins-base1.0-0 libgstreamer-plugins-base1.0-dev
$ gst-inspect-1.0 | grep omx
omx: omxmpeg2videodec: OpenMAX MPEG2 Video Decoder
omx: omxmpeg4videodec: OpenMAX MPEG4 Video Decoder
omx: omxh263dec: OpenMAX H.263 Video Decoder
omx: omxh264dec: OpenMAX H.264 Video Decoder
omx: omxtheoradec: OpenMAX Theora Video Decoder
omx: omxvp8dec: OpenMAX VP8 Video Decoder
omx: omxmjpegdec: OpenMAX MJPEG Video Decoder
omx: omxvc1dec: OpenMAX WMV Video Decoder
omx: omxh264enc: OpenMAX H.264 Video Encoder
pi@raspberrypi ~/gstreamer-1.0 $ gst-inspect-1.0 | grep fbdevsink
fbdevsink: fbdevsink: fbdev video sink



Step2.MPEG2のライセンスキーの購入
http://www.raspberrypi.com/mpeg-2-license-key/


Step3.ハードウェアエンコード
 ネット上より参考に見つけたやり方。
gst-launch-1.0 \
filesrc location=daitosho_PV.mpg  ! progressreport ! mpegpsdemux name=demuxer demuxer. ! queue ! \
mpegaudioparse ! mad ! audioresample ! audioconvert dithering=0 ! voaacenc bitrate=196000 ! mux. \
mp4mux  name=mux ! filesink location=hoge.mp4 demuxer. ! queue ! \
mpegvideoparse ! omxmpeg2videodec ! videoconvert ! \
omxh264enc target-bitrate=6000000 control-rate=variable ! video/x-h264,stream-format=byte-stream,profile=high ! \
h264parse ! mux.


これをやればうまく行くんだろうけど、目的は容量削減ではなく、
chromebookがMpeg2の再生に対応していないので、再生できるようにMpeg4へトランスコードすることである。
それとせっかくのRaspberryPiがハードウェアエンコードとデコードが使えるので、これらを使えるようにする。

やり方
1.TSファイルから必要な情報のみ取り出す。
  (これだけで、90%くらいに縮む。 21MB→19MB)
 $ tssplitter_lite src.ts dst.ts -1  (SIDはTS毎異なる)

2.TSファイルを分割する。(MPEG2動画とAAC音声に分ける)
 $ ffmpeg -y -i dst.ts -acodec copy dst.aac -vcodec copy -an dst.m2v

3.動画をMPEG2→MPEG4に変換する。
 $ gst-launch-1.0 filesrc location=a.m2v ! mpegvideoparse ! omxmpeg2videodec ! videoconvert ! omxh264enc ! filesink location=test.mp4

4.MPEG4とAACファイルをそのまま結合する。
 $ ffmpeg -i out.mp4 -i a.aac -vcodec copy -acodec copy output.mp4
 (最終結果で2.3MB、おおよそ10分の1)

これでMpeg4ファイルが完成してとてもコンパクトになったが、
インターレースの格子がひどいのでStep3は見直しが必要である。






○TSファイルから必要なデータのみ抽出
 wget http://hp.vector.co.jp/authors/VA038175/download/tssplitter_lite.zip
unzip tssplitter_lite.zip
cd tssplitter_lite
make all
cd tssplitter_lite
sudo cp tssplitter_lite /usr/local/bin/

使い方:tssplitter_lite source.ts dest.ts [SID]

 SIDの調べ方は、
  ffmpeg -i source.ts
 を実行して、Mepg2Videoになっている一番上にある番号が使うSID(1056など)



参考URL

http://theiopage.blogspot.jp/2013/04/enabling-hardware-h264-encoding-with.html

2014年11月25日火曜日

ChromebookでSkype、2chmateなどのAndroidアプリを使えるようにする方法

ネット上でいろんなやり方があって散見しているのでまとめてみた。

いろんなサイトに書かれていることなので知っているかもしれませんが、

AndroidアプリはAndroid用なので、そのままChromebookでは使えません。
 使えるようにするには、変換する必要があります。

変換するやり方は色々あるのですが、個人的に一番楽だと思った方法はスマホとChromebook両方使う方法です。

簡単にやり方を説明すると、スマホ・タブレット側でアプリの変換作業を行ってGoogleドライブに保存して、Chromebook側でダウンロードしてインストールする方法です。
この作業にはスマホ・タブレット、Chromebook側にARchronというアプリをインストールする必要があるので、これから実際にアプリを動作するところまで説明したいと思います。


・事前準備<Archonインストール>

~Chromebook側~

Step1.ChromeOSのバージョン情報を調べる
 まず自分の使っているPCがIntel 32bit/64bit,ARMなのか知る必要があります。

  デスクトップ右下にある時計部分をクリック設定→ChromeOSについて

 を開くとそこに情報がのっています。


Step2.ARChonのダウンロードとインストール
2-1.ARChonのダウンロード
 ARChonダウンロードサイトはここ。↓

 ZIPファイル形式で配布されてるので、あらかじめ慣れている環境でSDカードに展開しておくとChromebook上でフォルダ指定するだけになるので楽かも。

2-2.Chromebookに拡張機能ARChonをインストールする。
 用意できたらChromebook上のブラウザを開いて、URL入力部分に「chrome://extension」と入力するとChrome拡張機能画面を開く。

 一番上のところにチェックボックスで「デベロッパーモード」にチェックを入れる。

 次に表示された「パッケージ化されていない拡張機能を読み込む」を選択して、先ほど展開しARChronフォルダを指定するとインストールされる。

※これからインストールするAndroidアプリもChrome拡張機能なので、同じやり方でインストールします。

~スマホ・タブレット側~

Step1.スマホ・タブレットにARChonインストール
 スマホかタブレット上のPlayストアから「ARChon Packager」「Googleドライブ」をインストールする。 


これで準備完了。

次はAndroidアプリをChromebookで使えるようにする変換作業とGooleDrive経由でイメージコピーする方法です。

・ChromebookにAndroidアプリのインストール

~スマホ・タブレット側~
Step1.AndroidアプリのChrome拡張機能用に変換する
 「ARChon Packager」を起動して変換したいアプリ選択。
 英語のメッセージがいくつか出てくるけどそのまま「次へ」を押していき、Finishボタンが出たところで共有でGoogleドライブにZipファイルを置く。


~Chromebook側~
Step1.Chromebook側:Googleドライブにアプリをコピー
 ChromebookでGoogleドライブを起動して、Zipファイルをどこかに展開。
 (あとでごちゃごちゃしないように、専用フォルダを作っておくと良いです)

Step2.インストール
 ARChonをインストールした時と同じように、「Chrome機能拡張」画面を開いて「パッケージ化されていない拡張機能を読み込む」を選択して、先ほど展開しARChronフォルダを指定する。


これで完了。

変換したAndroidアプリを指定してもうまくインストールできてない方は、ARChronがインストールできてないか、Androidアプリが使えないのかどちらかだと思います。

試しにやってみたのがSkypeと2chmate。
Chromebook用の専用アプリじゃないので、まともに動かすにはいろいろコツが必要でした。

・Skype
 ログインはMicrosoftアカウントだとログインできないが、Skypeアカウントだとなぜかログインできる。

・2chmate
 起動しただけだとドルイド画面のまま。右クリックとかすると板一覧が表示される。

こんな感じです。
きっと他のアプリも似た感じだと思うので、今後のバージョンアップに期待してます。

2014年11月17日月曜日

raspberry Pi でまず最初にやるOS設定


1. アップデート
>sudo rpi-update
>sudo apt-get update
>sudo apt-get upgrade
>sudo raspi-config
>sudo apt-get install vim


2. 不要サービス無効化
[root@ms03 ~]# pico /etc/inittab
# /sbin/getty invocations for the runlevels.
#
# The "id" field MUST be the same as the last
# characters of the device (after "tty").
#
# Format:
#  :::
#
# Note that on most Debian systems tty7 is used by the X Window System,
# so if you want to add more getty's go ahead but skip tty7 if you run X.
#
# コンソールは使用可能とするのでtty1は生かし、tty2~tty6をコメント行に変更
1:2345:respawn:/sbin/getty --noclear 38400 tty1
# 2:23:respawn:/sbin/getty 38400 tty2
# 3:23:respawn:/sbin/getty 38400 tty3
# 4:23:respawn:/sbin/getty 38400 tty4
# 5:23:respawn:/sbin/getty 38400 tty5
# 6:23:respawn:/sbin/getty 38400 tty6


3.Swap停止
>sudo apt-get install chkconfig
>sudo chkconfig dphys-swapfile off


4.ログファイルの整理



3.リモートデスクトップ環境を入れる
>sudo apt-get install xrdp

4.Sambaインストール
>sudo apt-get install samba

UUIDを調べる
sudo blkid /dev/sda1 



参考URL:
 http://www.pc-links.com/blog/raspberrypi/ramdisk/






2014年11月13日木曜日

chromebookでネットワーク上の共有フォルダにアクセスする

今までWin7デスクトップPCを起動して散らかったデスクトップ(PC内部とリアルの話)を見ながら楽しいネットライフを過ごしていたのだが、
ChromeBookを買って以来、デスクトップPCを起動する時間がめっきり減った。

便利さといえばWindowsのが圧倒的でいわゆる何でも屋。
オンラインゲームからちょっと怪しげなツールも動かせて便利だし、今まで買ったハードウェアも充実している。
Chromebookはそういった事はできないけど、きれいなデスクトップにきれいな文字でいつでも使えて、起動の遅さなどの鬱陶しさもなく快適。これは体感しないとわからないかなと思う。


ここから表題の話。
2014年11月現在のChromeOSではSambaは使えない。
つまり家にNAS環境があるのにネットワーク共有フォルダが参照できないのである。
これは不便なのでどうにかして使えるようにしたい。


調べてみるとやり方は2つあって
①crouton上でSambaを入れてアクセスできるようにする方法。
②すでに入っているCifsを利用する。

①は作業の手間が多いので、
参照URLだけ残しておく。

②は非常に簡単にできるが、いつかのアップデートで使えなくなる可能性はあるので注意。

Step1. Chromeブラウザ上でCTRL+ALT+Tキーを押してコマンドプロンプトを開く。
Step2. shell [enter]キー
Step3. sudo vim /usr/local/etc/fstab を開く

//192.168.11.138/hdd2tb /home/chromeos/user/Downloads/Network/hdd2tb cifs username=guest,iocharset=utf8,defaults 0 0

環境に合わせて設定して保存。

Step4. sudo mountcifs start

以上、で共有フォルダにアクセスできる。

Androider