FFMPEG: Stream a file with original playing rate












3














I want to stream a file to the network using ffmpeg in it's original frame rate; so I can play the generated UDP stream using some receiver client such as VLC. I used this command:




ffmpeg -i "myfile.mpg" -sameq -re -f mpegts "udp://127.0.0.1:2000"




By using this command the ffmpeg starts streaming the file in a very high rate; such that streaming of a file that has about 30 minutes length, is finished after just about 40 secs. I want to see the file in original rate. Also I want to have control on rate of video to play it faster or slower. Is there any options to do this? thank you.










share|improve this question



























    3














    I want to stream a file to the network using ffmpeg in it's original frame rate; so I can play the generated UDP stream using some receiver client such as VLC. I used this command:




    ffmpeg -i "myfile.mpg" -sameq -re -f mpegts "udp://127.0.0.1:2000"




    By using this command the ffmpeg starts streaming the file in a very high rate; such that streaming of a file that has about 30 minutes length, is finished after just about 40 secs. I want to see the file in original rate. Also I want to have control on rate of video to play it faster or slower. Is there any options to do this? thank you.










    share|improve this question

























      3












      3








      3


      2





      I want to stream a file to the network using ffmpeg in it's original frame rate; so I can play the generated UDP stream using some receiver client such as VLC. I used this command:




      ffmpeg -i "myfile.mpg" -sameq -re -f mpegts "udp://127.0.0.1:2000"




      By using this command the ffmpeg starts streaming the file in a very high rate; such that streaming of a file that has about 30 minutes length, is finished after just about 40 secs. I want to see the file in original rate. Also I want to have control on rate of video to play it faster or slower. Is there any options to do this? thank you.










      share|improve this question













      I want to stream a file to the network using ffmpeg in it's original frame rate; so I can play the generated UDP stream using some receiver client such as VLC. I used this command:




      ffmpeg -i "myfile.mpg" -sameq -re -f mpegts "udp://127.0.0.1:2000"




      By using this command the ffmpeg starts streaming the file in a very high rate; such that streaming of a file that has about 30 minutes length, is finished after just about 40 secs. I want to see the file in original rate. Also I want to have control on rate of video to play it faster or slower. Is there any options to do this? thank you.







      networking ffmpeg streaming vlc-media-player video-streaming






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 21 '12 at 7:45









      sajad

      12316




      12316






















          2 Answers
          2






          active

          oldest

          votes


















          3














          -re should be used as an input option, otherwise it will probably be ignored. A generalization of the basic syntax is:



          ffmpeg [input options] -i input [output options] output


          Do not use -sameq. See sameq does not mean "same quality" for a detailed explanation.



          Have you tried simply copying the streams instead of re-encoding? Add -map 0 -codec copy as output options.



          As for changing the video speed you can try the setpts multimedia filter. Note that you have to re-encode to use this filter. Examples from the documentation:



          Apply fast motion effect: -filter:v setpts=0.5*PTS
          Apply slow motion effect: -filter:v setpts=2.0*PTS


          For audio see the asetpts or atempo filters.






          share|improve this answer































            1














            The answer is to use option -re. It should be put with the input options (before -i).




            -re (input)



            Read input at native frame rate. Mainly used to simulate a grab device, or live input stream (e.g. when reading from a file). Should not be used with actual grab devices or live input streams (where it can cause packet loss). By default ffmpeg attempts to read the input(s) as fast as possible. This option will slow down the reading of the input(s) to the native frame rate of the input(s). It is useful for real-time output (e.g. live streaming).







            share|improve this answer





















              Your Answer








              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "3"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f508560%2fffmpeg-stream-a-file-with-original-playing-rate%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              3














              -re should be used as an input option, otherwise it will probably be ignored. A generalization of the basic syntax is:



              ffmpeg [input options] -i input [output options] output


              Do not use -sameq. See sameq does not mean "same quality" for a detailed explanation.



              Have you tried simply copying the streams instead of re-encoding? Add -map 0 -codec copy as output options.



              As for changing the video speed you can try the setpts multimedia filter. Note that you have to re-encode to use this filter. Examples from the documentation:



              Apply fast motion effect: -filter:v setpts=0.5*PTS
              Apply slow motion effect: -filter:v setpts=2.0*PTS


              For audio see the asetpts or atempo filters.






              share|improve this answer




























                3














                -re should be used as an input option, otherwise it will probably be ignored. A generalization of the basic syntax is:



                ffmpeg [input options] -i input [output options] output


                Do not use -sameq. See sameq does not mean "same quality" for a detailed explanation.



                Have you tried simply copying the streams instead of re-encoding? Add -map 0 -codec copy as output options.



                As for changing the video speed you can try the setpts multimedia filter. Note that you have to re-encode to use this filter. Examples from the documentation:



                Apply fast motion effect: -filter:v setpts=0.5*PTS
                Apply slow motion effect: -filter:v setpts=2.0*PTS


                For audio see the asetpts or atempo filters.






                share|improve this answer


























                  3












                  3








                  3






                  -re should be used as an input option, otherwise it will probably be ignored. A generalization of the basic syntax is:



                  ffmpeg [input options] -i input [output options] output


                  Do not use -sameq. See sameq does not mean "same quality" for a detailed explanation.



                  Have you tried simply copying the streams instead of re-encoding? Add -map 0 -codec copy as output options.



                  As for changing the video speed you can try the setpts multimedia filter. Note that you have to re-encode to use this filter. Examples from the documentation:



                  Apply fast motion effect: -filter:v setpts=0.5*PTS
                  Apply slow motion effect: -filter:v setpts=2.0*PTS


                  For audio see the asetpts or atempo filters.






                  share|improve this answer














                  -re should be used as an input option, otherwise it will probably be ignored. A generalization of the basic syntax is:



                  ffmpeg [input options] -i input [output options] output


                  Do not use -sameq. See sameq does not mean "same quality" for a detailed explanation.



                  Have you tried simply copying the streams instead of re-encoding? Add -map 0 -codec copy as output options.



                  As for changing the video speed you can try the setpts multimedia filter. Note that you have to re-encode to use this filter. Examples from the documentation:



                  Apply fast motion effect: -filter:v setpts=0.5*PTS
                  Apply slow motion effect: -filter:v setpts=2.0*PTS


                  For audio see the asetpts or atempo filters.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Mar 20 '17 at 10:17









                  Community

                  1




                  1










                  answered Nov 21 '12 at 17:52









                  llogan

                  25k54576




                  25k54576

























                      1














                      The answer is to use option -re. It should be put with the input options (before -i).




                      -re (input)



                      Read input at native frame rate. Mainly used to simulate a grab device, or live input stream (e.g. when reading from a file). Should not be used with actual grab devices or live input streams (where it can cause packet loss). By default ffmpeg attempts to read the input(s) as fast as possible. This option will slow down the reading of the input(s) to the native frame rate of the input(s). It is useful for real-time output (e.g. live streaming).







                      share|improve this answer


























                        1














                        The answer is to use option -re. It should be put with the input options (before -i).




                        -re (input)



                        Read input at native frame rate. Mainly used to simulate a grab device, or live input stream (e.g. when reading from a file). Should not be used with actual grab devices or live input streams (where it can cause packet loss). By default ffmpeg attempts to read the input(s) as fast as possible. This option will slow down the reading of the input(s) to the native frame rate of the input(s). It is useful for real-time output (e.g. live streaming).







                        share|improve this answer
























                          1












                          1








                          1






                          The answer is to use option -re. It should be put with the input options (before -i).




                          -re (input)



                          Read input at native frame rate. Mainly used to simulate a grab device, or live input stream (e.g. when reading from a file). Should not be used with actual grab devices or live input streams (where it can cause packet loss). By default ffmpeg attempts to read the input(s) as fast as possible. This option will slow down the reading of the input(s) to the native frame rate of the input(s). It is useful for real-time output (e.g. live streaming).







                          share|improve this answer












                          The answer is to use option -re. It should be put with the input options (before -i).




                          -re (input)



                          Read input at native frame rate. Mainly used to simulate a grab device, or live input stream (e.g. when reading from a file). Should not be used with actual grab devices or live input streams (where it can cause packet loss). By default ffmpeg attempts to read the input(s) as fast as possible. This option will slow down the reading of the input(s) to the native frame rate of the input(s). It is useful for real-time output (e.g. live streaming).








                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Dec 14 at 21:55









                          Aleksandr Dubinsky

                          330414




                          330414






























                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Super User!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.





                              Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                              Please pay close attention to the following guidance:


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f508560%2fffmpeg-stream-a-file-with-original-playing-rate%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              How do I know what Microsoft account the skydrive app is syncing to?

                              When does type information flow backwards in C++?

                              Grease: Live!