Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: How to convert to .mp4 (for streaming)?

  1. #1
    Join Date
    Aug 2008
    Beans
    844

    How to convert to .mp4 (for streaming)?

    Hello.
    I've tried various different things such as "ffmpeg -i input.avi output.mp4" and even included vcodec libx264 and a ton of things.
    But it doesn't stream. It pre-buffers (downloads the whole thing first).
    Now I have to upload them to youtube and then download the mp4 file, and then upload them to the web.
    So, what setup do they use on youtube and other video streaming sites for that matter?

  2. #2
    Join Date
    Dec 2006
    Beans
    7,349

    Re: How to convert to .mp4 (for streaming)?

    Hmmmmm.... in the not too distant past you would run your file through qt-faststart after encoding with FFmpeg. Not sure if this is still the case though as I believe this can now be an option at the FFmpeg commandline in more recent FFmpeg versions.
    Last edited by andrew.46; May 17th, 2013 at 02:07 PM.
    You think that's air you're breathing now?

  3. #3
    Join Date
    Jul 2012
    Beans
    322
    Distro
    Xubuntu 18.04 Bionic Beaver

    Re: How to convert to .mp4 (for streaming)?

    From: http://ffmpeg.org/trac/ffmpeg/wiki/U...onGuideQuantal - by you know who

    Optional Installation

    qt-faststart

    This is a useful tool if you're showing your H.264 in MP4 videos on the web. It relocates some data in the video to allow playback to begin before the file is completely downloaded. Usage: qt-faststart input.mp4 output.mp4. When converting files with ffmpeg you can add -movflags faststart to have the same effect.

    Code:
    cd ~/ffmpeg make tools/qt-faststart 
    
    sudo checkinstall --pkgname=qt-faststart --pkgversion="$(date +%Y%m%d%H%M)-git" --backup=no \   
    --deldoc=yes --fstrans=no --default install -Dm755 tools/qt-faststart \   
    /usr/local/bin/qt-faststart
    The best things in life are free, so what are we paying for?

  4. #4
    Join Date
    Aug 2008
    Beans
    844

    Re: How to convert to .mp4 (for streaming)?

    Quote Originally Posted by Merrattic View Post
    From: http://ffmpeg.org/trac/ffmpeg/wiki/U...onGuideQuantal - by you know who

    Optional Installation

    qt-faststart

    This is a useful tool if you're showing your H.264 in MP4 videos on the web. It relocates some data in the video to allow playback to begin before the file is completely downloaded. Usage: qt-faststart input.mp4 output.mp4. When converting files with ffmpeg you can add -movflags faststart to have the same effect.
    Thanks. but it says it's for quicktime files.
    I could convert the avi's to mov first, but I don't wanna lose more quality than necessarily.

    Any other ideas?
    Edit: what commands do they use over at youtube and other sites like that?
    Do any of you know???
    Last edited by colobix; May 17th, 2013 at 06:49 PM.

  5. #5
    Join Date
    Sep 2006
    Beans
    3,713

    Re: How to convert to .mp4 (for streaming)?

    Quote Originally Posted by colobix View Post
    So, what setup do they use on youtube and other video streaming sites for that matter?
    "Streaming" generally means that the encoder is working in real time. What you're trying to do is called "progressive download" meaning that the content has already been encoded and you want the client to playback while the video is being downloaded.

    Quote Originally Posted by colobix View Post
    Thanks. but it says it's for quicktime files.
    It doesn't matter. Works for mp4 too:
    Code:
    ffmpeg -i input.mp4 -codec copy -map 0 -movflags faststart output.mp4
    or
    Code:
    qt-faststart input.mp4 output.mp4
    or
    Code:
    sudo apt-get install gpac
    MP4Box -add input.mp4 output.mp4
    These commands will basically all do the same thing, but the ffmpeg command is the most flexible because you can do other stuff too like add or change metadata:
    Code:
    ffmpeg -i input.mp4 -codec copy -map 0 -movflags faststart -metadata title="Merrattic's Avatar is a Weird Looking Rat" -metadata author="My Avatar is a guy from India with an old VCR" output.mp4
    Last edited by FakeOutdoorsman; May 17th, 2013 at 08:23 PM.

  6. #6
    Join Date
    Aug 2008
    Beans
    844

    Re: How to convert to .mp4 (for streaming)?

    Quote Originally Posted by FakeOutdoorsman View Post
    "Streaming" generally means that the encoder is working in real time. What you're trying to do is called "progressive download" meaning that the content has already been encoded and you want the client to playback while the video is being downloaded.
    Thanks.
    But just to clarify. you said input.mp4 output.mp4.
    So what you're saying is, first I have to convert it to mp4 using ffmpeg and then use this qt software to encode it?
    Because I tried avi to mp4 using your command, but it wouldn't work
    Getting an error:

    Code:
    fmpeg -i in.avi -codec copy -map 0 -movflags faststart output.mp4
    ffmpeg version 0.8.6-4:0.8.6-0ubuntu0.12.04.1, Copyright (c) 2000-2013 the Libav developers
      built on Apr  2 2013 17:02:36 with gcc 4.6.3
    *** THIS PROGRAM IS DEPRECATED ***
    This program is only provided for compatibility and will be removed in a future release. Please use avconv instead.
    
    Seems stream 0 codec frame rate differs from container frame rate: 23.98 (65535/2733) -> 23.98 (24000/1001)
    Input #0, avi, from 'in.avi':
      Metadata:
        encoder         : VirtualDubMod 1.5.4.1 (build 2178/release)
      Duration: 00:07:17.52, start: 0.000000, bitrate: 1128 kb/s
        Stream #0.0: Video: mpeg4 (Advanced Simple Profile), yuv420p, 640x480 [PAR 1:1 DAR 4:3], 23.98 tbr, 23.98 tbn, 23.98 tbc
        Stream #0.1: Audio: mp3, 48000 Hz, stereo, s16, 89 kb/s
    Unrecognized option 'codec'
    Failed to set value 'copy' for option 'codec'
    
    Last edited by colobix; May 17th, 2013 at 08:37 PM.

  7. #7
    Join Date
    Sep 2006
    Beans
    3,713

    Re: How to convert to .mp4 (for streaming)?

    Quote Originally Posted by colobix View Post
    Thanks.
    But just to clarify. you said input.mp4 output.mp4.
    So what you're saying is, first I have to convert it to mp4 using ffmpeg and then use this qt software to encode it?
    qt-faststart does not encode. It simply moves a chunk of information to the beginning of the file but must create a new output to do so.

    Quote Originally Posted by colobix View Post
    Because I tried avi to mp4 using your command, but it wouldn't work
    Getting an error:

    Code:
    fmpeg -i in.avi -codec copy -map 0 -movflags faststart output.mp4
    ffmpeg version 0.8.6-4:0.8.6-0ubuntu0.12.04.1, Copyright (c) 2000-2013 the Libav developers
      built on Apr  2 2013 17:02:36 with gcc 4.6.3
    *** THIS PROGRAM IS DEPRECATED ***
    This program is only provided for compatibility and will be removed in a future release. Please use avconv instead.
    
    Seems stream 0 codec frame rate differs from container frame rate: 23.98 (65535/2733) -> 23.98 (24000/1001)
    Input #0, avi, from 'in.avi':
      Metadata:
        encoder         : VirtualDubMod 1.5.4.1 (build 2178/release)
      Duration: 00:07:17.52, start: 0.000000, bitrate: 1128 kb/s
        Stream #0.0: Video: mpeg4 (Advanced Simple Profile), yuv420p, 640x480 [PAR 1:1 DAR 4:3], 23.98 tbr, 23.98 tbn, 23.98 tbc
        Stream #0.1: Audio: mp3, 48000 Hz, stereo, s16, 89 kb/s
    Unrecognized option 'codec'
    Failed to set value 'copy' for option 'codec'
    
    That's because you're not using ffmpeg from FFmpeg, but an old, fake, crappy version from a fork (see my signature links). Get a static build or compile ffmpeg, or use MP4Box as shown in the previous post.

  8. #8
    Join Date
    Aug 2008
    Beans
    844

    Re: How to convert to .mp4 (for streaming)?

    Quote Originally Posted by FakeOutdoorsman View Post
    qt-faststart does not encode. It simply moves a chunk of information to the beginning of the file but must create a new output to do so.



    That's because you're not using ffmpeg from FFmpeg, but an old, fake, crappy version from a fork (see my signature links). Get a static build or compile ffmpeg, or use MP4Box as shown in the previous post.
    Fake? I'm using the ubuntu repo's version.
    Why would there even be a fake version of ffmpeg out there anyway?
    Do you mean it has a virus or something?
    Anyway, this is getting extremely ridiculous.
    Is there or isn't there a possible way of doing this on linux?
    I'm getting tired of things not working the way they should.

  9. #9
    Join Date
    Dec 2006
    Beans
    7,349

    Re: How to convert to .mp4 (for streaming)?

    Your copy of FFmpeg is a little old and syntax has moved around a little I'm afraid. But have you tried FakeOutdoorsman's suggested MP4Box syntax?
    You think that's air you're breathing now?

  10. #10
    Join Date
    Aug 2008
    Beans
    844

    Re: How to convert to .mp4 (for streaming)?

    Quote Originally Posted by andrew.46 View Post
    Your copy of FFmpeg is a little old and syntax has moved around a little I'm afraid. But have you tried FakeOutdoorsman's suggested MP4Box syntax?
    I tried his commands, but they didn't do it either.
    Do you have a ppa for the up to date ffmpeg?

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •