ffmpeg conversion to mpeg2video

32,636
ffmpeg -i input -codec:v mpeg2video -qscale:v 2 -codec:a mp2 -b:a 192k output.mpg

Control quantizer scale with -qscale:v. Effective range for mpeg2video is a linear scale of 2-31 where 2 is the highest quality. Or you could use -b:v instead if you want to declare a specific bitrate.

mpeg2video only supports specific frame rates (see ffmpeg -h encoder=mpeg2video), so you may need to use -r as an output option to change it to a compatible frame rate. ffmpeg will simply drop or duplicate frames to match the desired output frame rate.

Share:
32,636
gogasca
Author by

gogasca

This is my personal developer profile. Currently I'm the Technical Leader in Google Vertex AI The relevant SO tag is gcp-ai-platform-notebook Interests: Machine Learning Infrastructure Jupyter Notebooks Distributed Systems Real-Time Communications (SIP, RTP, WebRTC)

Updated on November 20, 2020

Comments

  • gogasca
    gogasca over 3 years

    Need to play some video files from a Cisco DMP, and need to use mpeg2video for video and mp2 for audio.

    Im using ffmpeg -i to verify video format.

    This video plays correctly:

    Input #0, mpeg, from 'ATT_Telepresence_Scheduling.mpg':
      Duration: 00:07:14.08, start: 0.522456, bitrate: 474 kb/s
        Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p, 600x340 [SAR 1:1 DAR 30:17], 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
        Stream #0:1[0x1c0]: Audio: mp2, 44100 Hz, stereo, s16p, 128 kb/s
    

    This video does not play(Black screen):

    Input #0, mpegts, from 'Telepresence_part2.ts':
    Duration: 00:02:32.83, start: 1.000000, bitrate: 8783 kb/s
    Program 1 
    Stream #0:0[0x45]: Audio: aac ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 163 kb/s
    Stream #0:1[0x44]: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 29.92 fps, 29.92 tbr, 90k tbn, 59.82 tbc
    

    How to perform the conversion to mpeg and to video mpeg2video and audio mp2 and preserve HD quality?