VideoHelp Forum
+ Reply to Thread
Results 1 to 21 of 21
Thread
  1. Hi everybody

    I'm trying to transcode a video PS file to a Transport stream video file with a lower bitrate (9mb/s)
    My source video properties are:
    Input #0, mpeg, from 'C:/Testing50MbMPEG2.mpg':
    Duration: 00:09:35.99, start: 0.943711, bitrate: 53723 kb/s
    Stream #0.0[0x1e0]: Video: mpeg2video (4:2:2), yuv422p,
    1920x1080 [PAR 1:1 DAR 16:9], 50000 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0.1[0xa0]: Audio: pcm_dvd, 48000 Hz, 2 channels, s32, 2304 kb/s


    I want to get a CBR with Null Packets. but I donīt know how to do it with command line. Audio destination must be in mp2.

    Is there any template for TS for using with Avanti?

    Thanks for all
    Quote Quote  
  2. Member
    Join Date
    Sep 2007
    Location
    Europe
    Search PM
    Do you want to keep it HD or downscale to 720x576. For HD, 9mb/s would give very bad results.

    There is no template for TS but you could modify e.g. the "MPEG-2 / HQ elementary streams for DVD" template.

    1. load above mentioned template
    2. set "Container" field to "ts"
    3. set "Bitrate", "Min rate" and "Max rate" all to 9000 to force CBR

    But this is only useful if you plan to downscale the frame size.

    I don't know what Null Packets are. This is what FFmpeg reports with above settings;

    mpegts @ 01c2a5e0] muxrate VBR, pcr every 2 pkts, sdt every 200, pat/pmt every 40 pkts

    Perhaps someone else can point to more dedicated software for TS encoding?

    Quote Quote  
  3. Thanks for your help

    I want to keep the source resolution. I don't know how to insert null packets with ffmpeg.

    Another question:

    What can i do for keeping the same mapping that i have in the source videofile?

    I've got another ts file which has two audio streams with audio descriptors. The stream 0.2 doesnīt appear

    Input #0, mpegts, from tests2.ts':
    Duration: 00:09:35.92, start: 600.000000, bitrate: 51648 kb/s
    Program 1
    Stream #0.0[0x1011]: Video: mpeg2video (4:2:2), yuv422p,
    1920x1080 [PAR 1:1 DAR 16:9], 50000 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0.1[0x1100](fre): Audio: mp2, 48000 Hz, stereo, s16, 224 kb/s
    Stream #0.2[0x1101](eng): Audio: mp2, 48000 Hz, stereo, s16, 224 kb/s
    ---------------------------------------------------------------------------------
    Output #0, mpegts, to 'nul.ts':
    Stream #0.0: Video: mpeg2video, yuv422p, 1920x1080 [PAR 1:1 DAR 16:9],
    q=2-31, pass 1, 9000 kb/s, 90k tbn, 25 tbc
    Stream #0.1(fre): Audio: mp2, 48000 Hz, stereo, s16, 192 kb/s
    ---------------------------------------------------------------------------------
    Stream mapping:
    Stream #0.0 -> #0.0
    Stream #0.1 -> #0.1
    Quote Quote  
  4. Member
    Join Date
    Sep 2007
    Location
    Europe
    Search PM
    Originally Posted by manding74 View Post
    I want to keep the source resolution. I don't know how to insert null packets with ffmpeg.
    http://en.wikipedia.org/wiki/MPEG_transport_stream#Null_packets

    It seems that transport streams for ATSC and DVB require strict CBR and to accomplish that the muxer needs to insert dummy null packets. I can't find a option in FFmpeg for that purpose.

    Another question:

    What can i do for keeping the same mapping that i have in the source videofile?

    I've got another ts file which has two audio streams with audio descriptors. The stream 0.2 doesnīt appear
    It's probably already enough to add > -newaudio at the end of the "User VIDEO options" command line, e.g.;

    -g 12 -bf 2 -dc 10 -flags2 +ivlc -mbd 2 -trellis 1 > -newaudio

    At the first pass you won't see the second audio stream but at the second pass it should be there.
    Last edited by Chris K; 7th Jun 2011 at 08:32. Reason: changed encoder to muxer
    Quote Quote  
  5. don't know how to insert null packets with ffmpeg.
    not sure, but wouldn't you set the -muxrate in ffmpeg ?

    also, don't you need to set the buffer along with bitrate/min rate/max rate ? CBR requires min rate = maxrate and buffer needs to be set

    kieranrk is working on open broadcast encoder and x262 (MPEG2), but it's not ready yet
    http://code.google.com/p/open-broadcast-encoder/
    http://www.ob-encoder.com/
    Quote Quote  
  6. Member
    Join Date
    Sep 2007
    Location
    Europe
    Search PM
    Originally Posted by poisondeathray View Post
    also, don't you need to set the buffer along with bitrate/min rate/max rate ? CBR requires min rate = maxrate and buffer needs to be set
    Yes true, but if the OP used the suggested template to modify, there is already a VBV buffer size 1835k set.

    not sure, but wouldn't you set the -muxrate in ffmpeg ?
    I tried that this afternoon with a value of 12000 which I found in a example. I then get this...

    [mpegts @ 01c67920] muxrate 12000, pcr every 0 pkts, sdt every 3, pat/pmt every 0 pkts

    Also looked at the mpegts muxer source code and it's clear it has a function to write null packets. It looks like it does this automatically but indeed I wonder if this requires to use -muxrate. If not used the message shows muxrate VBR...

    [mpegts @ 01c50d20] muxrate VBR, pcr every 2 pkts, sdt every 200, pat/pmt every 40 pkts

    Quote Quote  
  7. Was your muxrate 12000 test done at 9000Mb/s video bitrate, and did it alter the filesize compared to using no muxrate ? Wouldn't you expect padded TS to be larger ?
    Quote Quote  
  8. Member
    Join Date
    Sep 2007
    Location
    Europe
    Search PM
    Short clip, same encode settings ...

    video:13655kB ... Muxrate VBR
    video:13655kB ... Muxrate 12000

    I think I give up! Perhaps only the involved FFmpeg developer knows the answer
    Quote Quote  
  9. Not sure either...

    Another free muxer the OP might want to test out is tsmuxer. In the "general" tab, there are settings for CBR muxing, including buffer and bitrate. Not sure how well it works
    Quote Quote  
  10. Member
    Join Date
    Sep 2007
    Location
    Europe
    Search PM
    Sorry, I made a few mistakes!

    1. muxrate should have been 12000k not 12000.
    2. I looked at the video size as reported by FFmpeg.

    Should have looked at the muxing overhead (or final file size).

    muxing overhead 8.059291% ... muxrate VBR
    muxing overhead 33.355141% ... muxrate 12000k

    IfoEdit uses 10080k as DVD program muxrate so 12000k looks reasonable.
    Get no errors with that. Lower muxrates occasionally give...

    [mpegts @ 028805a0] dts < pcr, TS is invalid
    Last edited by Chris K; 7th Jun 2011 at 15:42.
    Quote Quote  
  11. I'm trying obencoder which inserts null packets, but i don't know how to do it. Can you give an example how to insert audio descriptors in avanti. Only mux 1audio stream. Thank you
    Quote Quote  
  12. Member
    Join Date
    Sep 2007
    Location
    Europe
    Search PM
    What do you mean with audio descriptors, this ...

    http://en.wikipedia.org/wiki/Audio_description

    or simply this ...

    -alang code ... set the ISO 639 language code (3 letters) of the current audio stream.

    or perhaps still something else?
    Quote Quote  
  13. I meant to ISO 639. Can you show me an example of command line with 2 audio streams with "fra" and "eng" descriptor?

    I've found in Ffmpeg's help an explanation to this case but i don't know how to apply it.

    -alang code set the ISO 639 language code (3 letters) of the current aud
    io stream

    My knowledge of Ffmpeg are very poor.

    This is my source video file and i want to get a ts output with two audio streams:


    Input #0, mpegts, from tests2.ts':
    Duration: 00:09:35.92, start: 600.000000, bitrate: 51648 kb/s
    Program 1
    Stream #0.0[0x1011]: Video: mpeg2video (4:2:2), yuv422p,
    1920x1080 [PAR 1:1 DAR 16:9], 50000 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0.1[0x1100](fre): Audio: mp2, 48000 Hz, stereo, s16, 224 kb/s
    Stream #0.2[0x1101](eng): Audio: mp2, 48000 Hz, stereo, s16, 224 kb/s
    ---------------------------------------------------------------------------------
    Output #0, mpegts, to 'nul.ts':
    Stream #0.0: Video: mpeg2video, yuv422p, 1920x1080 [PAR 1:1 DAR 16:9],
    q=2-31, pass 1, 9000 kb/s, 90k tbn, 25 tbc
    Stream #0.1(fre): Audio: mp2, 48000 Hz, stereo, s16, 192 kb/s
    ---------------------------------------------------------------------------------
    Stream mapping:
    Stream #0.0 -> #0.0
    Stream #0.1 -> #0.1



    Thanks for your patience
    Quote Quote  
  14. Member
    Join Date
    Sep 2007
    Location
    Europe
    Search PM
    First a few notes ...

    In one of your previous posts you wrote you want 9000 kb/s CBR and keep the 1920x1080 resolution. You can't expect good results when you reduce a 50000 kb/s source to 9000 kb/s and keep the same resolution.

    The FFmpeg command line for two audio tracks would look like ...

    ffmpeg -i "input.ts" <video options> -alang fre <audio options> -y "output.ts" -alang eng -ab 192k -newaudio

    Since your source already has mp2 audio streams, you can also copy them to preserve audio quality ...

    ffmpeg -i "input.ts" <video options> -alang fre -acodec copy -y "output.ts" -alang eng -acodec copy -newaudio

    The attached zip contains two example templates for Avanti. You need to unpack and copy them to the templates folder and load them at the template USER tab. Please read the comments first after loading. One re-encodes audio, the other copies it.
    Image Attached Files
    Quote Quote  
  15. I have to get a transport stream with null packets and 2 audio streams. Bitrate must be about 9mb/s and with cbr. Can you show me another idea? I think that the quality is good because source video has a high bitrate (50 mb/s)
    Quote Quote  
  16. Member
    Join Date
    Sep 2007
    Location
    Europe
    Search PM
    Sorry, this is all I can offer with my (limited) knowledge of FFmpeg. You could first encode to elementary streams (m2v, mp2) and then try tsmuxer like poisondeathray suggested in a earlier post.

    Perhaps other people can help if you explain what your goal is with the final ts stream and why the specs need to be that strict.
    Quote Quote  
  17. Thanks for your help
    Quote Quote  
  18. Hi all

    I am trying to mux video and two audio streams into a transport stream video file.

    How can i do it with AVANTI?

    There is no problem with one audio stream but and i can't do it with 2 audio streams

    I've got: video.m2v, audio1.mp2 and audio2.mp2. I don't need to reencode audio streams.

    Thanks
    Quote Quote  
  19. Member
    Join Date
    Sep 2007
    Location
    Europe
    Search PM
    Avanti isn't the easiest app to do that. You need to do some command line work.

    There's a item in the help at index "FFmpeg/Demux, Mux and Copy" named "How to set up complex muxing operations.".

    If you set the video "Codec" field to "Copy Video" and press <F1> you easily get to that help section.
    Quote Quote  
  20. It works fine. but i don't know how to get a ts file with VOD cablelabs specs. It shows too many errors in multiplexing buffer overflowed...

    Avanti:
    muxrate VBR, pcr every 2 pkts, sdt every 200, pat/pmt every 40
    ... pkts

    I was trying to do it with obe-vod but it doesn't support MPEG2 codec

    Thanks
    Quote Quote  
  21. Member
    Join Date
    Sep 2007
    Location
    Europe
    Search PM
    Originally Posted by manding74 View Post
    how to get a ts file with VOD cablelabs specs. It shows too many errors in multiplexing buffer overflowed...
    Can't be of help much on that! You can look here ...

    http://www.pixeltools.com/tech_tip_cablelabs.html

    There's a download of a zip with ini files that shows VBV buffer size and muxrate values for SD and HD. For SD, I had some success with "VBV buffer size" set to 112 and by adding -muxrate 9000k to the command line.

    EDIT: You also need to enable the "Rewrite PTS" option.

    Also keep in mind that your source m2v needs to satisfy certain criteria like SD bitrate 3.75 mbps and HD bitrate 19.0 mbps.

    I was trying to do it with obe-vod but it doesn't support MPEG2 codec
    They seems to plan it for the future.
    Last edited by Chris K; 6th Jul 2011 at 08:56.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!