mp4 to mpeg-2 ts pcr period

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

mp4 to mpeg-2 ts pcr period

dariusz w
Hello,
Can anyone help with conversion from mp4 to ts.

ffmpeg -i input.mp4 -c copy -bsf:v h264_mp4toannex output.ts

outpu.ts plays fine in vlc etc. but output.ts isn't compatibilie with hardware decoders. pcr is rare in output.ts.




Reply | Threaded
Open this post in threaded view
|

Re: mp4 to mpeg-2 ts pcr period

Moritz Barsnick
On Wed, Oct 26, 2016 at 04:49:42 -0700, dariusz w wrote:
> ffmpeg -i input.mp4 -c copy -bsf:v h264_mp4toannex output.ts
                                     ^^^^^^^^^^^^^^
This filter is called "h264_mp4toannexb" (note the last letter). In
recent ffmpeg releases and with latest git, it is automatically
inserted, you don't need to do so anymore.

> outpu.ts plays fine in vlc etc. but output.ts isn't compatibilie with
> hardware decoders. pcr is rare in output.ts.

Which hardware decoder are you referring to? What is "pcr"?

You should show us the (proper) command line, and the command's full
uncut console output, so that we can get an idea what has gone wrong.

In the meantime, please ensure that you are testing this with latest
git (if possible, else latest release).

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

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

Re: mp4 to mpeg-2 ts pcr period

dariusz w
Thanks,

Yes I meant h264_mp4toannexb sorry for that.

I use latest stable version 3.1.5. This video should be played on STB eg. motorola 1853.
full output

ffmpeg version 3.1.5 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 4.9.2 (Debian 4.9.2-10)
  configuration: --prefix=/home/darek/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/darek/ffmpeg_build/include --extra-ldflags=-L/home/darek/ffmpeg_build/lib --bindir=/home/darek/bin --enable-gpl --enable-libfdk-aac --enable-libfreetype --enable-libx264 --enable-nonfree --disable-vaapi
  libavutil      55. 28.100 / 55. 28.100
  libavcodec     57. 48.101 / 57. 48.101
  libavformat    57. 41.100 / 57. 41.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 47.100 /  6. 47.100
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
  libpostproc    54.  0.100 / 54.  0.100
 matched as AVOption 'debug' with argument 'info'.
Reading option '-i' ... matched as input file with argument '/srv/vod-ingest-temp/video/POL_SPI103157_CHEF_HD.mp4'.
Reading option '-c' ... matched as option 'c' (codec name) with argument 'copy'.
Reading option '/srv/vod-ingest-temp/video/POL_SPI103157_CHEF_HD.ts' ... matched as output file.
Finished splitting the commandline.
Parsing a group of options: global .
Successfully parsed a group of options.
Parsing a group of options: input file /srv/vod-ingest-temp/video/POL_SPI103157_CHEF_HD.mp4.
Successfully parsed a group of options.
Opening an input file: /srv/vod-ingest-temp/video/POL_SPI103157_CHEF_HD.mp4.
[file @ 0x27a7b40] Setting default whitelist 'file,crypto'
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x27a7460] Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x27a7460] ISO: File Type Major Brand: mp42
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x27a7460] Unknown dref type 0x08206c7275 size 12
    Last message repeated 1 times
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x27a7460] Before avformat_find_stream_info() pos: 14444560 bytes read:2774717 seeks:1 nb_streams:2
[NULL @ 0x27a9520] [Eval @ 0x7ffe3ecc47b0] Invalid chars 'o' at the end of expression 'info'
[NULL @ 0x27a9520] Unable to parse option value "info"
[NULL @ 0x27a9520] Error setting option debug to value info.
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x27a7460] Failed to open codec in av_find_stream_info
[NULL @ 0x27aa9e0] [Eval @ 0x7ffe3ecc47b0] Invalid chars 'o' at the end of expression 'info'
[NULL @ 0x27aa9e0] Unable to parse option value "info"
[NULL @ 0x27aa9e0] Error setting option debug to value info.
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x27a7460] Failed to open codec in av_find_stream_info
[h264 @ 0x27a9520] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 0x27a9520] nal_unit_type: 8, nal_ref_idc: 3
[h264 @ 0x27a9520] nal_unit_type: 9, nal_ref_idc: 0
[h264 @ 0x27a9520] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 0x27a9520] nal_unit_type: 8, nal_ref_idc: 3
[h264 @ 0x27a9520] nal_unit_type: 6, nal_ref_idc: 0
    Last message repeated 2 times
[h264 @ 0x27a9520] nal_unit_type: 5, nal_ref_idc: 3
[h264 @ 0x27a9520] user data:"x264 - core 129 - H.264/MPEG-4 AVC codec - Copyleft 2003-2013 - http://www.videolan.org/x264.html - options: cabac=1 ref=4 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=8 b_pyramid=0 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=0 intra_refresh=0 rc_lookahead=40 rc=cbr mbtree=1 bitrate=5000 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=5000 vbv_bufsize=10000 nal_hrd=cbr ip_ratio=1.40 aq=1:1.00"
[h264 @ 0x27a9520] no picture
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x27a7460] All info found
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x27a7460] After avformat_find_stream_info() pos: 14947338 bytes read:3252551 seeks:1 frames:26
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/srv/vod-ingest-temp/video/POL_SPI103157_CHEF_HD.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42isom
    creation_time   : 2016-05-11 21:44:08
  Duration: 01:49:39.12, start: 0.000000, bitrate: 5179 kb/s
    Stream #0:0(eng), 25, 1/25000: Video: h264 (Main), 1 reference frame (avc1 / 0x31637661), yuv420p(left), 1920x1080 (1920x1088) [SAR 1:1 DAR 16:9], 0/1, 4999 kb/s, 25 fps, 25 tbr, 25k tbn, 50 tbc (default)
    Stream #0:1(und), 1, 1/44100: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 157 kb/s (default)
Successfully opened the file.
Parsing a group of options: output file /srv/vod-ingest-temp/video/POL_SPI103157_CHEF_HD.ts.
Applying option c (codec name) with argument copy.
Successfully parsed a group of options.
Opening an output file: /srv/vod-ingest-temp/video/POL_SPI103157_CHEF_HD.ts.
File '/srv/vod-ingest-temp/video/POL_SPI103157_CHEF_HD.ts' already exists. Overwrite ? [y/N] y
[file @ 0x2d005a0] Setting default whitelist 'file,crypto'
Successfully opened the file.
[mpegts @ 0x2cfd720] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
    Last message repeated 1 times
[mpegts @ 0x2cfd720] muxrate VBR, pcr every 2500 pkts, sdt every 200, pat/pmt every 40 pkts
Output #0, mpegts, to '/srv/vod-ingest-temp/video/POL_SPI103157_CHEF_HD.ts':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42isom
    encoder         : Lavf57.41.100
    Stream #0:0(eng), 0, 1/90000: Video: h264, 1 reference frame (avc1 / 0x31637661), yuv420p(left), 1920x1080 (0x0) [SAR 1:1 DAR 16:9], 0/1, q=2-31, 4999 kb/s, 25 fps, 25 tbr, 90k tbn, 25k tbc (default)
    Stream #0:1(und), 0, 1/90000: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, 157 kb/s (default)
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
    Last message repeated 1 times
Automatically inserted bitstream filter 'h264_mp4toannexb'; args=''
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
    Last message repeated 24 times
frame= 9201 fps=4811 q=-1.0 Lsize=  251693kB time=00:06:08.82 bitrate=5590.4kbits/s speed= 193x
video:224936kB audio:7097kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 8.473374%
Input file #0 (/srv/vod-ingest-temp/video/POL_SPI103157_CHEF_HD.mp4):
  Input stream #0:0 (video): 9201 packets read (230334204 bytes);
  Input stream #0:1 (audio): 15884 packets read (7267042 bytes);
  Total: 25085 packets (237601246 bytes) demuxed
Output file #0 (/srv/vod-ingest-temp/video/POL_SPI103157_CHEF_HD.ts):
  Output stream #0:0 (video): 9201 packets muxed (230334204 bytes);
  Output stream #0:1 (audio): 15884 packets muxed (7267042 bytes);
  Total: 25085 packets (237601246 bytes) muxed
0 frames successfully decoded, 0 decoding errors
[AVIOContext @ 0x2d006a0] Statistics: 0 seeks, 15239 writeouts
[AVIOContext @ 0x27aff60] Statistics: 240923008 bytes read, 19 seeks


as you can see pcr is every 2500 packets it is too rare.


I have found that this command:

./ffmpeg -debug info -i input.mp4 -c copy -muxrate 7000k output.ts

remux *.ts and I see that pcr period is fine for hw decoder.

[mpegts @ 0x3579ea0] muxrate 7000000, pcr every 93 pkts, sdt every 2327, pat/pmt every 465 pkts

so maybe I should use muxrate everytime?

Reply | Threaded
Open this post in threaded view
|

Re: mp4 to mpeg-2 ts pcr period

Carl Eugen Hoyos-2
2016-10-26 15:42 GMT+02:00 dariusz w <[hidden email]>:

> I use latest stable version 3.1.5.

There is nothing "stable" about 3.1.5 (see for example #5909),
on the contrary, it contains more known bugs and less features
than current FFmpeg.

[...]

> I have found that this command:
>
> ./ffmpeg -debug info -i input.mp4 -c copy -muxrate 7000k output.ts
>
> remux *.ts and I see that pcr period is fine for hw decoder.
>
> [mpegts @ 0x3579ea0] muxrate 7000000, pcr every 93 pkts,
> sdt every 2327, pat/pmt every 465 pkts
>
> so maybe I should use muxrate everytime?

If it solves your issue, this is likely a good idea.
This sounds like ticket #5750, btw.

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

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